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)
.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;
perf_evsel__name(evsel));
}
-char *perf_evsel__env_arch(struct perf_evsel *evsel)
-{
- if (evsel && evsel->evlist && evsel->evlist->env)
- return evsel->evlist->env->arch;
- return NULL;
-}
-
struct perf_env *perf_evsel__env(struct perf_evsel *evsel)
{
if (evsel && evsel->evlist)
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);
struct perf_env *perf_evsel__env(struct perf_evsel *evsel);
#endif /* __PERF_EVSEL_H */