mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
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 <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-rh1qv051vb8gfdcswskrn53h@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
5449f13c55
commit
3285debaf5
3 changed files with 8 additions and 17 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue