perf annotate: Add evsel into struct annotation_line_args
Add evsel into struct annotate_args to reduce the number of arguments that need to travel all the way to line allocation. This change also allow us to move the arch name initialization under symbol__annotate function. Link: http://lkml.kernel.org/n/tip-a9ok53rrgt1s5e8uglyvy6qt@git.kernel.org Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20171011150158.11895-11-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
4748834f96
commit
d03a686ea6
4 changed files with 11 additions and 7 deletions
|
@ -1120,7 +1120,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map,
|
||||||
(nr_pcnt - 1);
|
(nr_pcnt - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
err = symbol__annotate(sym, map, perf_evsel__env_arch(evsel),
|
err = symbol__annotate(sym, map, evsel,
|
||||||
sizeof_bdl, &browser.arch,
|
sizeof_bdl, &browser.arch,
|
||||||
perf_evsel__env_cpuid(evsel));
|
perf_evsel__env_cpuid(evsel));
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
|
@ -169,8 +169,7 @@ static int symbol__gtk_annotate(struct symbol *sym, struct map *map,
|
||||||
if (map->dso->annotate_warned)
|
if (map->dso->annotate_warned)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
err = symbol__annotate(sym, map, perf_evsel__env_arch(evsel),
|
err = symbol__annotate(sym, map, evsel, 0, NULL, NULL);
|
||||||
0, NULL, NULL);
|
|
||||||
if (err) {
|
if (err) {
|
||||||
char msg[BUFSIZ];
|
char msg[BUFSIZ];
|
||||||
symbol__strerror_disassemble(sym, map, err, msg, sizeof(msg));
|
symbol__strerror_disassemble(sym, map, err, msg, sizeof(msg));
|
||||||
|
|
|
@ -882,6 +882,7 @@ struct annotate_args {
|
||||||
size_t privsize;
|
size_t privsize;
|
||||||
struct arch *arch;
|
struct arch *arch;
|
||||||
struct map *map;
|
struct map *map;
|
||||||
|
struct perf_evsel *evsel;
|
||||||
s64 offset;
|
s64 offset;
|
||||||
char *line;
|
char *line;
|
||||||
int line_nr;
|
int line_nr;
|
||||||
|
@ -1570,16 +1571,21 @@ out_close_stdout:
|
||||||
}
|
}
|
||||||
|
|
||||||
int symbol__annotate(struct symbol *sym, struct map *map,
|
int symbol__annotate(struct symbol *sym, struct map *map,
|
||||||
const char *arch_name, size_t privsize,
|
struct perf_evsel *evsel, size_t privsize,
|
||||||
struct arch **parch, char *cpuid)
|
struct arch **parch, char *cpuid)
|
||||||
{
|
{
|
||||||
struct annotate_args args = {
|
struct annotate_args args = {
|
||||||
.privsize = privsize,
|
.privsize = privsize,
|
||||||
.map = map,
|
.map = map,
|
||||||
|
.evsel = evsel,
|
||||||
};
|
};
|
||||||
|
const char *arch_name = NULL;
|
||||||
struct arch *arch;
|
struct arch *arch;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
if (evsel)
|
||||||
|
arch_name = perf_evsel__env_arch(evsel);
|
||||||
|
|
||||||
arch_name = annotate__norm_arch(arch_name);
|
arch_name = annotate__norm_arch(arch_name);
|
||||||
if (!arch_name)
|
if (!arch_name)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1975,8 +1981,7 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map,
|
||||||
struct rb_root source_line = RB_ROOT;
|
struct rb_root source_line = RB_ROOT;
|
||||||
u64 len;
|
u64 len;
|
||||||
|
|
||||||
if (symbol__annotate(sym, map, perf_evsel__env_arch(evsel),
|
if (symbol__annotate(sym, map, evsel, 0, NULL, NULL) < 0)
|
||||||
0, NULL, NULL) < 0)
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
len = symbol__size(sym);
|
len = symbol__size(sym);
|
||||||
|
|
|
@ -174,7 +174,7 @@ int symbol__alloc_hist(struct symbol *sym);
|
||||||
void symbol__annotate_zero_histograms(struct symbol *sym);
|
void symbol__annotate_zero_histograms(struct symbol *sym);
|
||||||
|
|
||||||
int symbol__annotate(struct symbol *sym, struct map *map,
|
int symbol__annotate(struct symbol *sym, struct map *map,
|
||||||
const char *arch_name, size_t privsize,
|
struct perf_evsel *evsel, size_t privsize,
|
||||||
struct arch **parch, char *cpuid);
|
struct arch **parch, char *cpuid);
|
||||||
|
|
||||||
enum symbol_disassemble_errno {
|
enum symbol_disassemble_errno {
|
||||||
|
|
Loading…
Reference in a new issue