lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Tue, 2 Jun 2015 15:10:56 -0300 From: Arnaldo Carvalho de Melo <acme@...nel.org> To: Jiri Olsa <jolsa@...nel.org> Cc: lkml <linux-kernel@...r.kernel.org>, Peter Zijlstra <a.p.zijlstra@...llo.nl>, Paul Mackerras <paulus@...ba.org>, David Ahern <dsahern@...il.com>, Namhyung Kim <namhyung@...nel.org>, Ingo Molnar <mingo@...nel.org>, Andi Kleen <ak@...ux.intel.com>, Stephane Eranian <eranian@...gle.com> Subject: Re: [PATCH 1/9] perf tools: Add nameid value into evsel object Em Tue, Jun 02, 2015 at 12:59:55AM +0200, Jiri Olsa escreveu: > Adding a way to tag an evsel object with ID value based > on its name. It will be used for transaction events, > but could be useful for others. For what? Can you ellaborate? Just by looking at this commit message I can't figure out the value of this patch :-\ - Arnaldo > This way we can identify transactions events and get rid > of the current position based way we use. > Link: http://lkml.kernel.org/n/tip-9lnvjksibrs0flhkpix2qkm9@git.kernel.org > Signed-off-by: Jiri Olsa <jolsa@...nel.org> > --- > tools/perf/util/evsel.c | 22 ++++++++++++++++++++++ > tools/perf/util/evsel.h | 11 +++++++++++ > tools/perf/util/parse-events.c | 2 +- > 3 files changed, 34 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c > index a3e36fc634dc..9e057319933d 100644 > --- a/tools/perf/util/evsel.c > +++ b/tools/perf/util/evsel.c > @@ -80,6 +80,28 @@ set_methods: > return 0; > } > > +#define ID(id, name) [PERF_EVSEL_NAMEID__##id] = #name > +static const char *nameid_str[PERF_EVSEL_NAMEID__MAX] = { > + ID(NONE, x), > +}; > +#undef ID > + > +void perf_evsel__name_init(struct perf_evsel *evsel, char *name) > +{ > + enum perf_evsel_nameid nameid = PERF_EVSEL_NAMEID__NONE; > + int i; > + > + for (i = 0; i < PERF_EVSEL_NAMEID__MAX; i++) { > + if (!strcmp(name, nameid_str[i])) { > + nameid = i; > + break; > + } > + } > + > + evsel->nameid = nameid; > + evsel->name = strdup(name); > +} > + > #define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y)) > > int __perf_evsel__sample_size(u64 sample_type) > diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h > index 21ec08247d47..f89f34f1a7a1 100644 > --- a/tools/perf/util/evsel.h > +++ b/tools/perf/util/evsel.h > @@ -46,6 +46,13 @@ struct perf_sample_id { > > struct cgroup_sel; > > +enum perf_evsel_nameid { > + PERF_EVSEL_NAMEID__NONE = 0, > + PERF_EVSEL_NAMEID__MAX, > +}; > + > +#define perf_evsel__is(evsel, id) (evsel->nameid == PERF_EVSEL_NAMEID__ ## id) > + > /** struct perf_evsel - event selector > * > * @name - Can be set to retain the original event name passed by the user, > @@ -100,6 +107,8 @@ struct perf_evsel { > unsigned long *per_pkg_mask; > struct perf_evsel *leader; > char *group_name; > + > + enum perf_evsel_nameid nameid; > }; > > union u64_swap { > @@ -366,4 +375,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); > > +void perf_evsel__name_init(struct perf_evsel *evsel, char *name); > + > #endif /* __PERF_EVSEL_H */ > diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c > index 2a4d1ec02846..abf0ff07b9cf 100644 > --- a/tools/perf/util/parse-events.c > +++ b/tools/perf/util/parse-events.c > @@ -890,7 +890,7 @@ int parse_events_name(struct list_head *list, char *name) > > __evlist__for_each(list, evsel) { > if (!evsel->name) > - evsel->name = strdup(name); > + perf_evsel__name_init(evsel, name); > } > > return 0; > -- > 1.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists