aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/annotate.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <[email protected]>2017-12-11 15:52:17 +0000
committerArnaldo Carvalho de Melo <[email protected]>2017-12-27 15:15:51 +0000
commit3285debaf5992f9729ba33e3f31eff5253d29dc4 (patch)
tree7c52f0af65f2603339d746ca5c1e47b0ea7e8226 /tools/perf/util/annotate.c
parentperf annotate: Get the cpuid from evsel->evlist->env in symbol__annotate() (diff)
downloadkernel-3285debaf5992f9729ba33e3f31eff5253d29dc4.tar.gz
kernel-3285debaf5992f9729ba33e3f31eff5253d29dc4.zip
perf annotate: Use perf_env when obtaining the arch name
Paving the way to reuse these routines in other areas, like when generating errno tables. 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]> Link: https://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Diffstat (limited to 'tools/perf/util/annotate.c')
-rw-r--r--tools/perf/util/annotate.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index bc34b28373f4..eac45ccd5c32 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1420,16 +1420,19 @@ fallback:
return 0;
}
-static const char *annotate__norm_arch(const char *arch_name)
+static const char *perf_env__arch(struct perf_env *env)
{
struct utsname uts;
+ char *arch_name;
- if (!arch_name) { /* Assume we are annotating locally. */
+ if (!env) { /* Assume local operation */
if (uname(&uts) < 0)
return NULL;
arch_name = uts.machine;
- }
- return normalize_arch((char *)arch_name);
+ } else
+ arch_name = env->arch;
+
+ return normalize_arch(arch_name);
}
static int symbol__disassemble(struct symbol *sym, struct annotate_args *args)
@@ -1630,14 +1633,10 @@ int symbol__annotate(struct symbol *sym, struct map *map,
.evsel = evsel,
};
struct perf_env *env = perf_evsel__env(evsel);
- const char *arch_name = NULL;
+ const char *arch_name = perf_env__arch(env);
struct arch *arch;
int err;
- if (evsel)
- arch_name = perf_evsel__env_arch(evsel);
-
- arch_name = annotate__norm_arch(arch_name);
if (!arch_name)
return -1;