perf evsel: The tracepoint constructor should store sys:name

Not event_format->name, that doesn't contains the sys: part.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-v9x3q9rv4caxtox7wtjpchq5@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 745cefc5
...@@ -122,6 +122,9 @@ struct perf_evsel *perf_evsel__newtp(const char *sys, const char *name, int idx) ...@@ -122,6 +122,9 @@ struct perf_evsel *perf_evsel__newtp(const char *sys, const char *name, int idx)
PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD), 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); evsel->tp_format = event_format__new(sys, name);
if (evsel->tp_format == NULL) if (evsel->tp_format == NULL)
goto out_free; goto out_free;
...@@ -130,12 +133,12 @@ struct perf_evsel *perf_evsel__newtp(const char *sys, const char *name, int idx) ...@@ -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.config = evsel->tp_format->id;
attr.sample_period = 1; attr.sample_period = 1;
perf_evsel__init(evsel, &attr, idx); perf_evsel__init(evsel, &attr, idx);
evsel->name = evsel->tp_format->name;
} }
return evsel; return evsel;
out_free: out_free:
free(evsel->name);
free(evsel); free(evsel);
return NULL; return NULL;
} }
...@@ -584,10 +587,8 @@ void perf_evsel__delete(struct perf_evsel *evsel) ...@@ -584,10 +587,8 @@ void perf_evsel__delete(struct perf_evsel *evsel)
perf_evsel__exit(evsel); perf_evsel__exit(evsel);
close_cgroup(evsel->cgrp); close_cgroup(evsel->cgrp);
free(evsel->group_name); free(evsel->group_name);
if (evsel->tp_format && evsel->name == evsel->tp_format->name) { if (evsel->tp_format)
evsel->name = NULL;
pevent_free_format(evsel->tp_format); pevent_free_format(evsel->tp_format);
}
free(evsel->name); free(evsel->name);
free(evsel); free(evsel);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment