perf evsel: Utility function to fetch arch
authorRavi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Thu, 30 Jun 2016 06:14:19 +0000 (11:44 +0530)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 30 Jun 2016 11:37:32 +0000 (08:37 -0300)
Add Utility function to fetch arch using evsel. (evsel->env->arch)

Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Anton Blanchard <anton@ozlabs.org>
Cc: Daniel Axtens <dja@axtens.net>
Cc: David Laight <David.Laight@ACULAB.COM>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/1467267262-4589-2-git-send-email-ravi.bangoria@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/evsel.c
tools/perf/util/evsel.h

index 1d8f2bbd38a793c7089f3461b93428f6cf6eda36..0fea724e735c34fb83fcc908bb63615e5e2c1fa0 100644 (file)
@@ -2422,3 +2422,10 @@ int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target,
                         err, strerror_r(err, sbuf, sizeof(sbuf)),
                         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;
+}
index 828ddd1c89474c976c5042e844079a7979a05758..86fed7a2932bda4ea996fe9a352b1bad4b19a91e 100644 (file)
@@ -435,4 +435,6 @@ typedef int (*attr__fprintf_f)(FILE *, const char *, const char *, void *);
 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);
+
 #endif /* __PERF_EVSEL_H */