From e48ffe2bd49936314d367a8c6b5eaaa17d581d13 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Wed, 26 Sep 2012 17:11:38 -0300 Subject: perf evsel: The tracepoint constructor should store sys:name Not event_format->name, that doesn't contains the sys: part. Cc: David Ahern Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Mike Galbraith Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/n/tip-v9x3q9rv4caxtox7wtjpchq5@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/evsel.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'tools') diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 6022daaa7417..6f2a8c30413e 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -122,6 +122,9 @@ struct perf_evsel *perf_evsel__newtp(const char *sys, const char *name, int idx) PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD), }; + if (asprintf(&evsel->name, "%s:%s", sys, name) < 0) + goto out_free; + evsel->tp_format = event_format__new(sys, name); if (evsel->tp_format == NULL) goto out_free; @@ -130,12 +133,12 @@ struct perf_evsel *perf_evsel__newtp(const char *sys, const char *name, int idx) attr.config = evsel->tp_format->id; attr.sample_period = 1; perf_evsel__init(evsel, &attr, idx); - evsel->name = evsel->tp_format->name; } return evsel; out_free: + free(evsel->name); free(evsel); return NULL; } @@ -584,10 +587,8 @@ void perf_evsel__delete(struct perf_evsel *evsel) perf_evsel__exit(evsel); close_cgroup(evsel->cgrp); free(evsel->group_name); - if (evsel->tp_format && evsel->name == evsel->tp_format->name) { - evsel->name = NULL; + if (evsel->tp_format) pevent_free_format(evsel->tp_format); - } free(evsel->name); free(evsel); } -- cgit v1.2.3