提交 5449f13c 编写于 作者: A Arnaldo Carvalho de Melo

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 <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-070eap7t6uicg9c3w086xy2z@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 901bb028
...@@ -138,7 +138,7 @@ static int perf_top__parse_source(struct perf_top *top, struct hist_entry *he) ...@@ -138,7 +138,7 @@ static int perf_top__parse_source(struct perf_top *top, struct hist_entry *he)
return err; return err;
} }
err = symbol__annotate(sym, map, evsel, 0, NULL, NULL); err = symbol__annotate(sym, map, evsel, 0, NULL);
if (err == 0) { if (err == 0) {
out_assign: out_assign:
top->sym_filter_entry = he; top->sym_filter_entry = he;
......
...@@ -1116,9 +1116,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, ...@@ -1116,9 +1116,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map,
if (perf_evsel__is_group_event(evsel)) if (perf_evsel__is_group_event(evsel))
nr_pcnt = evsel->nr_members; nr_pcnt = evsel->nr_members;
err = symbol__annotate(sym, map, evsel, err = symbol__annotate(sym, map, evsel, sizeof(struct browser_line), &browser.arch);
sizeof(struct browser_line), &browser.arch,
perf_evsel__env_cpuid(evsel));
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));
......
...@@ -169,7 +169,7 @@ static int symbol__gtk_annotate(struct symbol *sym, struct map *map, ...@@ -169,7 +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, evsel, 0, NULL, NULL); err = symbol__annotate(sym, map, evsel, 0, 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));
......
...@@ -1622,13 +1622,14 @@ void symbol__calc_percent(struct symbol *sym, struct perf_evsel *evsel) ...@@ -1622,13 +1622,14 @@ void symbol__calc_percent(struct symbol *sym, struct perf_evsel *evsel)
int symbol__annotate(struct symbol *sym, struct map *map, int symbol__annotate(struct symbol *sym, struct map *map,
struct perf_evsel *evsel, size_t privsize, struct perf_evsel *evsel, size_t privsize,
struct arch **parch, char *cpuid) struct arch **parch)
{ {
struct annotate_args args = { struct annotate_args args = {
.privsize = privsize, .privsize = privsize,
.map = map, .map = map,
.evsel = evsel, .evsel = evsel,
}; };
struct perf_env *env = perf_evsel__env(evsel);
const char *arch_name = NULL; const char *arch_name = NULL;
struct arch *arch; struct arch *arch;
int err; int err;
...@@ -1648,7 +1649,7 @@ int symbol__annotate(struct symbol *sym, struct map *map, ...@@ -1648,7 +1649,7 @@ int symbol__annotate(struct symbol *sym, struct map *map,
*parch = arch; *parch = arch;
if (arch->init) { if (arch->init) {
err = arch->init(arch, cpuid); err = arch->init(arch, env ? env->cpuid : NULL);
if (err) { if (err) {
pr_err("%s: failed to initialize %s arch priv area\n", __func__, arch->name); pr_err("%s: failed to initialize %s arch priv area\n", __func__, arch->name);
return err; return err;
...@@ -1999,7 +2000,7 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map, ...@@ -1999,7 +2000,7 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map,
struct dso *dso = map->dso; struct dso *dso = map->dso;
struct rb_root source_line = RB_ROOT; 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; return -1;
symbol__calc_percent(sym, evsel); symbol__calc_percent(sym, evsel);
......
...@@ -179,7 +179,7 @@ void symbol__annotate_zero_histograms(struct symbol *sym); ...@@ -179,7 +179,7 @@ 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,
struct perf_evsel *evsel, size_t privsize, struct perf_evsel *evsel, size_t privsize,
struct arch **parch, char *cpuid); struct arch **parch);
enum symbol_disassemble_errno { enum symbol_disassemble_errno {
SYMBOL_ANNOTATE_ERRNO__SUCCESS = 0, SYMBOL_ANNOTATE_ERRNO__SUCCESS = 0,
......
...@@ -2842,9 +2842,9 @@ char *perf_evsel__env_arch(struct perf_evsel *evsel) ...@@ -2842,9 +2842,9 @@ char *perf_evsel__env_arch(struct perf_evsel *evsel)
return NULL; 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) if (evsel && evsel->evlist)
return evsel->evlist->env->cpuid; return evsel->evlist->env;
return NULL; return NULL;
} }
...@@ -447,6 +447,6 @@ int perf_event_attr__fprintf(FILE *fp, struct perf_event_attr *attr, ...@@ -447,6 +447,6 @@ int perf_event_attr__fprintf(FILE *fp, struct perf_event_attr *attr,
attr__fprintf_f attr__fprintf, void *priv); attr__fprintf_f attr__fprintf, void *priv);
char *perf_evsel__env_arch(struct perf_evsel *evsel); 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 */ #endif /* __PERF_EVSEL_H */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册