diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/evsel.c | 24 | ||||
-rw-r--r-- | tools/perf/util/parse-events.c | 21 |
2 files changed, 14 insertions, 31 deletions
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 2da047331173..2ddc81271855 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -252,6 +252,11 @@ static int perf_evsel__hw_cache_name(struct perf_evsel *evsel, char *bf, size_t | |||
252 | return ret + perf_evsel__add_modifiers(evsel, bf + ret, size - ret); | 252 | return ret + perf_evsel__add_modifiers(evsel, bf + ret, size - ret); |
253 | } | 253 | } |
254 | 254 | ||
255 | static int perf_evsel__tracepoint_name(struct perf_evsel *evsel, char *bf, size_t size) | ||
256 | { | ||
257 | return scnprintf(bf, size, "%s", evsel->name ?: "unknown tracepoint"); | ||
258 | } | ||
259 | |||
255 | int perf_evsel__name(struct perf_evsel *evsel, char *bf, size_t size) | 260 | int perf_evsel__name(struct perf_evsel *evsel, char *bf, size_t size) |
256 | { | 261 | { |
257 | int ret; | 262 | int ret; |
@@ -273,20 +278,13 @@ int perf_evsel__name(struct perf_evsel *evsel, char *bf, size_t size) | |||
273 | ret = perf_evsel__sw_name(evsel, bf, size); | 278 | ret = perf_evsel__sw_name(evsel, bf, size); |
274 | break; | 279 | break; |
275 | 280 | ||
281 | case PERF_TYPE_TRACEPOINT: | ||
282 | ret = perf_evsel__tracepoint_name(evsel, bf, size); | ||
283 | break; | ||
284 | |||
276 | default: | 285 | default: |
277 | /* | 286 | ret = scnprintf(bf, size, "%s", "unknown attr type"); |
278 | * FIXME | 287 | break; |
279 | * | ||
280 | * This is the minimal perf_evsel__name so that we can | ||
281 | * reconstruct event names taking into account event modifiers. | ||
282 | * | ||
283 | * The old event_name uses it now for raw anr hw events, so that | ||
284 | * we don't drag all the parsing stuff into the python binding. | ||
285 | * | ||
286 | * On the next devel cycle the rest of the event naming will be | ||
287 | * brought here. | ||
288 | */ | ||
289 | return 0; | ||
290 | } | 288 | } |
291 | 289 | ||
292 | return ret; | 290 | return ret; |
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 641c4ac8a838..d73690b11242 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -203,24 +203,9 @@ const char *event_type(int type) | |||
203 | 203 | ||
204 | const char *event_name(struct perf_evsel *evsel) | 204 | const char *event_name(struct perf_evsel *evsel) |
205 | { | 205 | { |
206 | u64 config = evsel->attr.config; | 206 | static char bf[128]; |
207 | int type = evsel->attr.type; | 207 | perf_evsel__name(evsel, bf, sizeof(bf)); |
208 | 208 | return bf; | |
209 | if (type == PERF_TYPE_RAW || type == PERF_TYPE_HARDWARE || | ||
210 | type == PERF_TYPE_SOFTWARE || type == PERF_TYPE_HW_CACHE) { | ||
211 | /* | ||
212 | * XXX minimal fix, see comment on perf_evsen__name, this static buffer | ||
213 | * will go away together with event_name in the next devel cycle. | ||
214 | */ | ||
215 | static char bf[128]; | ||
216 | perf_evsel__name(evsel, bf, sizeof(bf)); | ||
217 | return bf; | ||
218 | } | ||
219 | |||
220 | if (evsel->name) | ||
221 | return evsel->name; | ||
222 | |||
223 | return __event_name(type, config); | ||
224 | } | 209 | } |
225 | 210 | ||
226 | const char *__event_name(int type, u64 config) | 211 | const char *__event_name(int type, u64 config) |