perf annotate: Get the cpuid from evsel->evlist->env in symbol__annotate()
tip-bot for Arnaldo Carvalho de Melo
merge botCommit-ID: 5449f13c553e9c50690419f6114665a8beb71bea Gitweb: https://git.kernel.org/tip/5449f13c553e9c50690419f6114665a8beb71bea Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Mon, 11 Dec 2017 12:46:11 -0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 27 Dec 2017 12:15:51 -0300
perf annotate: Get the cpuid from evsel->evlist->env in symbol__annotate()
To reduce its function signature, since we get this from 'evsel' which is already one of its arguments.
Cc Adrian Hunter <[email protected]>
Cc David Ahern <[email protected]>
Cc Hendrik Brueckner <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Michael Petlan <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Thomas Richter <[email protected]>
Cc Wang Nan <[email protected]>
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/builtin-top.c | 2 +- tools/perf/ui/browsers/annotate.c | 4 +--- tools/perf/ui/gtk/annotate.c | 2 +- tools/perf/util/annotate.c | 7 ++++--- tools/perf/util/annotate.h | 2 +- tools/perf/util/evsel.c | 6 +++--- tools/perf/util/evsel.h | 2 +- 7 files changed, 12 insertions(+), 13 deletions(-)
tools/perf/builtin-top.c +1 -1
@@ -138,7 +138,7 @@ static int perf_top__parse_source(struct perf_top *top, struct hist_entry *he)return err; } - err =symbol__annotate (sym, map, evsel,0 ,NULL ,NULL ); + err =symbol__annotate (sym, map, evsel,0 ,NULL );if (err ==0 ) { out_assign: top->sym_filter_entry = he;
tools/perf/ui/browsers/annotate.c +1 -3
@@ -1116,9 +1116,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map,if (perf_evsel__is_group_event (evsel)) nr_pcnt = evsel->nr_members; - err =symbol__annotate (sym, map, evsel, -sizeof (struct browser_line ), &browser.arch, -perf_evsel__env_cpuid (evsel)); + err =symbol__annotate (sym, map, evsel,sizeof (struct browser_line ), &browser.arch);if (err) {char msg[BUFSIZ ];symbol__strerror_disassemble (sym, map, err, msg,sizeof (msg));
tools/perf/ui/gtk/annotate.c +1 -1
@@ -169,7 +169,7 @@ static int symbol__gtk_annotate(struct symbol *sym, struct map *map,if (map->dso->annotate_warned)return -1 ; - err =symbol__annotate (sym, map, evsel,0 ,NULL ,NULL ); + err =symbol__annotate (sym, map, evsel,0 ,NULL );if (err) {char msg[BUFSIZ ];symbol__strerror_disassemble (sym, map, err, msg,sizeof (msg));
tools/perf/util/annotate.c +4 -3
@@ -1622,13 +1622,14 @@ void symbol__calc_percent(struct symbol *sym, struct perf_evsel *evsel)int symbol__annotate (struct symbol *sym,struct map *map,struct perf_evsel *evsel,size_t privsize, -struct arch **parch,char *cpuid) +struct arch **parch) {struct annotate_args args = { .privsize = privsize, .map = map, .evsel = evsel, }; +struct perf_env *env =perf_evsel__env (evsel);const char *arch_name =NULL ;struct arch *arch;int err;
@@ -1648,7 +1649,7 @@ int symbol__annotate(struct symbol *sym, struct map *map, *parch = arch;if (arch->init) { - err = arch->init (arch, cpuid); + err = arch->init (arch, env ? env->cpuid :NULL );if (err) {pr_err ("%s: failed to initialize %s arch priv area\n" , __func__, arch->name);return err;
@@ -1999,7 +2000,7 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map,struct dso *dso = map->dso;struct rb_root source_line =RB_ROOT ; -if (symbol__annotate (sym, map, evsel,0 ,NULL ,NULL ) <0 ) +if (symbol__annotate (sym, map, evsel,0 ,NULL ) <0 )return -1 ;symbol__calc_percent (sym, evsel);
tools/perf/util/annotate.h +1 -1
@@ -179,7 +179,7 @@ void symbol__annotate_zero_histograms(struct symbol *sym);int symbol__annotate (struct symbol *sym,struct map *map,struct perf_evsel *evsel,size_t privsize, -struct arch **parch,char *cpuid); +struct arch **parch);enum symbol_disassemble_errno {SYMBOL_ANNOTATE_ERRNO__SUCCESS =0 ,
tools/perf/util/evsel.c +3 -3
@@ -2842,9 +2842,9 @@ char *perf_evsel__env_arch(struct perf_evsel *evsel)return NULL ; } -char *perf_evsel__env_cpuid (struct perf_evsel *evsel) +struct perf_env *perf_evsel__env (struct perf_evsel *evsel) { -if (evsel && evsel->evlist && evsel->evlist->env) -return evsel->evlist->env->cpuid; +if (evsel && evsel->evlist) +return evsel->evlist->env;return NULL ; }
tools/perf/util/evsel.h +1 -1
@@ -447,6 +447,6 @@ int perf_event_attr__fprintf(FILE *fp, struct perf_event_attr *attr, attr__fprintf_f attr__fprintf, void *priv);char *perf_evsel__env_arch (struct perf_evsel *evsel); -char *perf_evsel__env_cpuid (struct perf_evsel *evsel); +struct perf_env *perf_evsel__env (struct perf_evsel *evsel);#endif /* __PERF_EVSEL_H */