diff options
-rw-r--r-- | tools/perf/builtin-evlist.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-record.c | 4 | ||||
-rw-r--r-- | tools/perf/builtin-report.c | 6 | ||||
-rw-r--r-- | tools/perf/builtin-stat.c | 12 | ||||
-rw-r--r-- | tools/perf/builtin-test.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 10 | ||||
-rw-r--r-- | tools/perf/ui/browsers/hists.c | 15 | ||||
-rw-r--r-- | tools/perf/ui/gtk/browser.c | 2 | ||||
-rw-r--r-- | tools/perf/util/evsel.c | 26 | ||||
-rw-r--r-- | tools/perf/util/evsel.h | 2 | ||||
-rw-r--r-- | tools/perf/util/header.c | 2 | ||||
-rw-r--r-- | tools/perf/util/parse-events.c | 7 | ||||
-rw-r--r-- | tools/perf/util/parse-events.h | 1 | ||||
-rw-r--r-- | tools/perf/util/session.c | 2 | ||||
-rw-r--r-- | tools/perf/util/top.c | 2 |
15 files changed, 40 insertions, 55 deletions
diff --git a/tools/perf/builtin-evlist.c b/tools/perf/builtin-evlist.c index acd78dc28341..0dd5a058f766 100644 --- a/tools/perf/builtin-evlist.c +++ b/tools/perf/builtin-evlist.c | |||
@@ -60,7 +60,7 @@ static int __cmd_evlist(const char *input_name, struct perf_attr_details *detail | |||
60 | list_for_each_entry(pos, &session->evlist->entries, node) { | 60 | list_for_each_entry(pos, &session->evlist->entries, node) { |
61 | bool first = true; | 61 | bool first = true; |
62 | 62 | ||
63 | printf("%s", event_name(pos)); | 63 | printf("%s", perf_evsel__name(pos)); |
64 | 64 | ||
65 | if (details->verbose || details->freq) { | 65 | if (details->verbose || details->freq) { |
66 | comma_printf(&first, " sample_freq=%" PRIu64, | 66 | comma_printf(&first, " sample_freq=%" PRIu64, |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index f95840d04e4c..f5a6452931e6 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -265,7 +265,7 @@ try_again: | |||
265 | 265 | ||
266 | if (err == ENOENT) { | 266 | if (err == ENOENT) { |
267 | ui__error("The %s event is not supported.\n", | 267 | ui__error("The %s event is not supported.\n", |
268 | event_name(pos)); | 268 | perf_evsel__name(pos)); |
269 | exit(EXIT_FAILURE); | 269 | exit(EXIT_FAILURE); |
270 | } | 270 | } |
271 | 271 | ||
@@ -916,7 +916,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __used) | |||
916 | usage_with_options(record_usage, record_options); | 916 | usage_with_options(record_usage, record_options); |
917 | 917 | ||
918 | list_for_each_entry(pos, &evsel_list->entries, node) { | 918 | list_for_each_entry(pos, &evsel_list->entries, node) { |
919 | if (perf_header__push_event(pos->attr.config, event_name(pos))) | 919 | if (perf_header__push_event(pos->attr.config, perf_evsel__name(pos))) |
920 | goto out_free_fd; | 920 | goto out_free_fd; |
921 | } | 921 | } |
922 | 922 | ||
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 25249f76329d..ea8ce8e1c0d8 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -230,7 +230,7 @@ static int process_read_event(struct perf_tool *tool, | |||
230 | struct perf_report *rep = container_of(tool, struct perf_report, tool); | 230 | struct perf_report *rep = container_of(tool, struct perf_report, tool); |
231 | 231 | ||
232 | if (rep->show_threads) { | 232 | if (rep->show_threads) { |
233 | const char *name = evsel ? event_name(evsel) : "unknown"; | 233 | const char *name = evsel ? perf_evsel__name(evsel) : "unknown"; |
234 | perf_read_values_add_value(&rep->show_threads_values, | 234 | perf_read_values_add_value(&rep->show_threads_values, |
235 | event->read.pid, event->read.tid, | 235 | event->read.pid, event->read.tid, |
236 | event->read.id, | 236 | event->read.id, |
@@ -239,7 +239,7 @@ static int process_read_event(struct perf_tool *tool, | |||
239 | } | 239 | } |
240 | 240 | ||
241 | dump_printf(": %d %d %s %" PRIu64 "\n", event->read.pid, event->read.tid, | 241 | dump_printf(": %d %d %s %" PRIu64 "\n", event->read.pid, event->read.tid, |
242 | evsel ? event_name(evsel) : "FAIL", | 242 | evsel ? perf_evsel__name(evsel) : "FAIL", |
243 | event->read.value); | 243 | event->read.value); |
244 | 244 | ||
245 | return 0; | 245 | return 0; |
@@ -314,7 +314,7 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist, | |||
314 | 314 | ||
315 | list_for_each_entry(pos, &evlist->entries, node) { | 315 | list_for_each_entry(pos, &evlist->entries, node) { |
316 | struct hists *hists = &pos->hists; | 316 | struct hists *hists = &pos->hists; |
317 | const char *evname = event_name(pos); | 317 | const char *evname = perf_evsel__name(pos); |
318 | 318 | ||
319 | hists__fprintf_nr_sample_events(hists, evname, stdout); | 319 | hists__fprintf_nr_sample_events(hists, evname, stdout); |
320 | hists__fprintf(hists, NULL, false, true, 0, 0, stdout); | 320 | hists__fprintf(hists, NULL, false, true, 0, 0, stdout); |
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 262589991ea4..875bf2675326 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -391,7 +391,7 @@ static int read_counter_aggr(struct perf_evsel *counter) | |||
391 | 391 | ||
392 | if (verbose) { | 392 | if (verbose) { |
393 | fprintf(output, "%s: %" PRIu64 " %" PRIu64 " %" PRIu64 "\n", | 393 | fprintf(output, "%s: %" PRIu64 " %" PRIu64 " %" PRIu64 "\n", |
394 | event_name(counter), count[0], count[1], count[2]); | 394 | perf_evsel__name(counter), count[0], count[1], count[2]); |
395 | } | 395 | } |
396 | 396 | ||
397 | /* | 397 | /* |
@@ -496,7 +496,7 @@ static int run_perf_stat(int argc __used, const char **argv) | |||
496 | errno == ENXIO) { | 496 | errno == ENXIO) { |
497 | if (verbose) | 497 | if (verbose) |
498 | ui__warning("%s event is not supported by the kernel.\n", | 498 | ui__warning("%s event is not supported by the kernel.\n", |
499 | event_name(counter)); | 499 | perf_evsel__name(counter)); |
500 | counter->supported = false; | 500 | counter->supported = false; |
501 | continue; | 501 | continue; |
502 | } | 502 | } |
@@ -594,7 +594,7 @@ static void nsec_printout(int cpu, struct perf_evsel *evsel, double avg) | |||
594 | csv_output ? 0 : -4, | 594 | csv_output ? 0 : -4, |
595 | evsel_list->cpus->map[cpu], csv_sep); | 595 | evsel_list->cpus->map[cpu], csv_sep); |
596 | 596 | ||
597 | fprintf(output, fmt, cpustr, msecs, csv_sep, event_name(evsel)); | 597 | fprintf(output, fmt, cpustr, msecs, csv_sep, perf_evsel__name(evsel)); |
598 | 598 | ||
599 | if (evsel->cgrp) | 599 | if (evsel->cgrp) |
600 | fprintf(output, "%s%s", csv_sep, evsel->cgrp->name); | 600 | fprintf(output, "%s%s", csv_sep, evsel->cgrp->name); |
@@ -792,7 +792,7 @@ static void abs_printout(int cpu, struct perf_evsel *evsel, double avg) | |||
792 | else | 792 | else |
793 | cpu = 0; | 793 | cpu = 0; |
794 | 794 | ||
795 | fprintf(output, fmt, cpustr, avg, csv_sep, event_name(evsel)); | 795 | fprintf(output, fmt, cpustr, avg, csv_sep, perf_evsel__name(evsel)); |
796 | 796 | ||
797 | if (evsel->cgrp) | 797 | if (evsel->cgrp) |
798 | fprintf(output, "%s%s", csv_sep, evsel->cgrp->name); | 798 | fprintf(output, "%s%s", csv_sep, evsel->cgrp->name); |
@@ -908,7 +908,7 @@ static void print_counter_aggr(struct perf_evsel *counter) | |||
908 | counter->supported ? CNTR_NOT_COUNTED : CNTR_NOT_SUPPORTED, | 908 | counter->supported ? CNTR_NOT_COUNTED : CNTR_NOT_SUPPORTED, |
909 | csv_sep, | 909 | csv_sep, |
910 | csv_output ? 0 : -24, | 910 | csv_output ? 0 : -24, |
911 | event_name(counter)); | 911 | perf_evsel__name(counter)); |
912 | 912 | ||
913 | if (counter->cgrp) | 913 | if (counter->cgrp) |
914 | fprintf(output, "%s%s", csv_sep, counter->cgrp->name); | 914 | fprintf(output, "%s%s", csv_sep, counter->cgrp->name); |
@@ -961,7 +961,7 @@ static void print_counter(struct perf_evsel *counter) | |||
961 | counter->supported ? CNTR_NOT_COUNTED : CNTR_NOT_SUPPORTED, | 961 | counter->supported ? CNTR_NOT_COUNTED : CNTR_NOT_SUPPORTED, |
962 | csv_sep, | 962 | csv_sep, |
963 | csv_output ? 0 : -24, | 963 | csv_output ? 0 : -24, |
964 | event_name(counter)); | 964 | perf_evsel__name(counter)); |
965 | 965 | ||
966 | if (counter->cgrp) | 966 | if (counter->cgrp) |
967 | fprintf(output, "%s%s", | 967 | fprintf(output, "%s%s", |
diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c index 5a8727c08757..5ce30305462b 100644 --- a/tools/perf/builtin-test.c +++ b/tools/perf/builtin-test.c | |||
@@ -583,7 +583,7 @@ static int test__basic_mmap(void) | |||
583 | if (nr_events[evsel->idx] != expected_nr_events[evsel->idx]) { | 583 | if (nr_events[evsel->idx] != expected_nr_events[evsel->idx]) { |
584 | pr_debug("expected %d %s events, got %d\n", | 584 | pr_debug("expected %d %s events, got %d\n", |
585 | expected_nr_events[evsel->idx], | 585 | expected_nr_events[evsel->idx], |
586 | event_name(evsel), nr_events[evsel->idx]); | 586 | perf_evsel__name(evsel), nr_events[evsel->idx]); |
587 | goto out_munmap; | 587 | goto out_munmap; |
588 | } | 588 | } |
589 | } | 589 | } |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 6bb0277b7dfe..8090a280578c 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -245,7 +245,7 @@ static void perf_top__show_details(struct perf_top *top) | |||
245 | if (notes->src == NULL) | 245 | if (notes->src == NULL) |
246 | goto out_unlock; | 246 | goto out_unlock; |
247 | 247 | ||
248 | printf("Showing %s for %s\n", event_name(top->sym_evsel), symbol->name); | 248 | printf("Showing %s for %s\n", perf_evsel__name(top->sym_evsel), symbol->name); |
249 | printf(" Events Pcnt (>=%d%%)\n", top->sym_pcnt_filter); | 249 | printf(" Events Pcnt (>=%d%%)\n", top->sym_pcnt_filter); |
250 | 250 | ||
251 | more = symbol__annotate_printf(symbol, he->ms.map, top->sym_evsel->idx, | 251 | more = symbol__annotate_printf(symbol, he->ms.map, top->sym_evsel->idx, |
@@ -408,7 +408,7 @@ static void perf_top__print_mapped_keys(struct perf_top *top) | |||
408 | fprintf(stdout, "\t[e] display entries (lines). \t(%d)\n", top->print_entries); | 408 | fprintf(stdout, "\t[e] display entries (lines). \t(%d)\n", top->print_entries); |
409 | 409 | ||
410 | if (top->evlist->nr_entries > 1) | 410 | if (top->evlist->nr_entries > 1) |
411 | fprintf(stdout, "\t[E] active event counter. \t(%s)\n", event_name(top->sym_evsel)); | 411 | fprintf(stdout, "\t[E] active event counter. \t(%s)\n", perf_evsel__name(top->sym_evsel)); |
412 | 412 | ||
413 | fprintf(stdout, "\t[f] profile display filter (count). \t(%d)\n", top->count_filter); | 413 | fprintf(stdout, "\t[f] profile display filter (count). \t(%d)\n", top->count_filter); |
414 | 414 | ||
@@ -503,13 +503,13 @@ static void perf_top__handle_keypress(struct perf_top *top, int c) | |||
503 | fprintf(stderr, "\nAvailable events:"); | 503 | fprintf(stderr, "\nAvailable events:"); |
504 | 504 | ||
505 | list_for_each_entry(top->sym_evsel, &top->evlist->entries, node) | 505 | list_for_each_entry(top->sym_evsel, &top->evlist->entries, node) |
506 | fprintf(stderr, "\n\t%d %s", top->sym_evsel->idx, event_name(top->sym_evsel)); | 506 | fprintf(stderr, "\n\t%d %s", top->sym_evsel->idx, perf_evsel__name(top->sym_evsel)); |
507 | 507 | ||
508 | prompt_integer(&counter, "Enter details event counter"); | 508 | prompt_integer(&counter, "Enter details event counter"); |
509 | 509 | ||
510 | if (counter >= top->evlist->nr_entries) { | 510 | if (counter >= top->evlist->nr_entries) { |
511 | top->sym_evsel = list_entry(top->evlist->entries.next, struct perf_evsel, node); | 511 | top->sym_evsel = list_entry(top->evlist->entries.next, struct perf_evsel, node); |
512 | fprintf(stderr, "Sorry, no such event, using %s.\n", event_name(top->sym_evsel)); | 512 | fprintf(stderr, "Sorry, no such event, using %s.\n", perf_evsel__name(top->sym_evsel)); |
513 | sleep(1); | 513 | sleep(1); |
514 | break; | 514 | break; |
515 | } | 515 | } |
@@ -960,7 +960,7 @@ try_again: | |||
960 | 960 | ||
961 | if (err == ENOENT) { | 961 | if (err == ENOENT) { |
962 | ui__error("The %s event is not supported.\n", | 962 | ui__error("The %s event is not supported.\n", |
963 | event_name(counter)); | 963 | perf_evsel__name(counter)); |
964 | goto out_err; | 964 | goto out_err; |
965 | } else if (err == EMFILE) { | 965 | } else if (err == EMFILE) { |
966 | ui__error("Too many events are opened.\n" | 966 | ui__error("Too many events are opened.\n" |
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index f556e5f6388b..482f0517b61e 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
@@ -1367,7 +1367,7 @@ static void perf_evsel_menu__write(struct ui_browser *browser, | |||
1367 | struct perf_evsel *evsel = list_entry(entry, struct perf_evsel, node); | 1367 | struct perf_evsel *evsel = list_entry(entry, struct perf_evsel, node); |
1368 | bool current_entry = ui_browser__is_current_entry(browser, row); | 1368 | bool current_entry = ui_browser__is_current_entry(browser, row); |
1369 | unsigned long nr_events = evsel->hists.stats.nr_events[PERF_RECORD_SAMPLE]; | 1369 | unsigned long nr_events = evsel->hists.stats.nr_events[PERF_RECORD_SAMPLE]; |
1370 | const char *ev_name = event_name(evsel); | 1370 | const char *ev_name = perf_evsel__name(evsel); |
1371 | char bf[256], unit; | 1371 | char bf[256], unit; |
1372 | const char *warn = " "; | 1372 | const char *warn = " "; |
1373 | size_t printed; | 1373 | size_t printed; |
@@ -1435,7 +1435,7 @@ browse_hists: | |||
1435 | */ | 1435 | */ |
1436 | if (timer) | 1436 | if (timer) |
1437 | timer(arg); | 1437 | timer(arg); |
1438 | ev_name = event_name(pos); | 1438 | ev_name = perf_evsel__name(pos); |
1439 | key = perf_evsel__hists_browse(pos, nr_events, help, | 1439 | key = perf_evsel__hists_browse(pos, nr_events, help, |
1440 | ev_name, true, timer, | 1440 | ev_name, true, timer, |
1441 | arg, delay_secs); | 1441 | arg, delay_secs); |
@@ -1504,17 +1504,11 @@ static int __perf_evlist__tui_browse_hists(struct perf_evlist *evlist, | |||
1504 | ui_helpline__push("Press ESC to exit"); | 1504 | ui_helpline__push("Press ESC to exit"); |
1505 | 1505 | ||
1506 | list_for_each_entry(pos, &evlist->entries, node) { | 1506 | list_for_each_entry(pos, &evlist->entries, node) { |
1507 | const char *ev_name = event_name(pos); | 1507 | const char *ev_name = perf_evsel__name(pos); |
1508 | size_t line_len = strlen(ev_name) + 7; | 1508 | size_t line_len = strlen(ev_name) + 7; |
1509 | 1509 | ||
1510 | if (menu.b.width < line_len) | 1510 | if (menu.b.width < line_len) |
1511 | menu.b.width = line_len; | 1511 | menu.b.width = line_len; |
1512 | /* | ||
1513 | * Cache the evsel name, tracepoints have a _high_ cost per | ||
1514 | * event_name() call. | ||
1515 | */ | ||
1516 | if (pos->name == NULL) | ||
1517 | pos->name = strdup(ev_name); | ||
1518 | } | 1512 | } |
1519 | 1513 | ||
1520 | return perf_evsel_menu__run(&menu, evlist->nr_entries, help, timer, | 1514 | return perf_evsel_menu__run(&menu, evlist->nr_entries, help, timer, |
@@ -1525,11 +1519,10 @@ int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, | |||
1525 | void(*timer)(void *arg), void *arg, | 1519 | void(*timer)(void *arg), void *arg, |
1526 | int delay_secs) | 1520 | int delay_secs) |
1527 | { | 1521 | { |
1528 | |||
1529 | if (evlist->nr_entries == 1) { | 1522 | if (evlist->nr_entries == 1) { |
1530 | struct perf_evsel *first = list_entry(evlist->entries.next, | 1523 | struct perf_evsel *first = list_entry(evlist->entries.next, |
1531 | struct perf_evsel, node); | 1524 | struct perf_evsel, node); |
1532 | const char *ev_name = event_name(first); | 1525 | const char *ev_name = perf_evsel__name(first); |
1533 | return perf_evsel__hists_browse(first, evlist->nr_entries, help, | 1526 | return perf_evsel__hists_browse(first, evlist->nr_entries, help, |
1534 | ev_name, false, timer, arg, | 1527 | ev_name, false, timer, arg, |
1535 | delay_secs); | 1528 | delay_secs); |
diff --git a/tools/perf/ui/gtk/browser.c b/tools/perf/ui/gtk/browser.c index fd41e8d10337..ec12e0b4ded6 100644 --- a/tools/perf/ui/gtk/browser.c +++ b/tools/perf/ui/gtk/browser.c | |||
@@ -199,7 +199,7 @@ int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, | |||
199 | 199 | ||
200 | list_for_each_entry(pos, &evlist->entries, node) { | 200 | list_for_each_entry(pos, &evlist->entries, node) { |
201 | struct hists *hists = &pos->hists; | 201 | struct hists *hists = &pos->hists; |
202 | const char *evname = event_name(pos); | 202 | const char *evname = perf_evsel__name(pos); |
203 | GtkWidget *scrolled_window; | 203 | GtkWidget *scrolled_window; |
204 | GtkWidget *tab_label; | 204 | GtkWidget *tab_label; |
205 | 205 | ||
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 2ddc81271855..236bdf25db6d 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -252,42 +252,42 @@ 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) | 255 | const char *perf_evsel__name(struct perf_evsel *evsel) |
256 | { | 256 | { |
257 | return scnprintf(bf, size, "%s", evsel->name ?: "unknown tracepoint"); | 257 | char bf[128]; |
258 | } | ||
259 | 258 | ||
260 | int perf_evsel__name(struct perf_evsel *evsel, char *bf, size_t size) | 259 | if (evsel->name) |
261 | { | 260 | return evsel->name; |
262 | int ret; | ||
263 | 261 | ||
264 | switch (evsel->attr.type) { | 262 | switch (evsel->attr.type) { |
265 | case PERF_TYPE_RAW: | 263 | case PERF_TYPE_RAW: |
266 | ret = scnprintf(bf, size, "raw 0x%" PRIx64, evsel->attr.config); | 264 | scnprintf(bf, sizeof(bf), "raw 0x%" PRIx64, evsel->attr.config); |
267 | break; | 265 | break; |
268 | 266 | ||
269 | case PERF_TYPE_HARDWARE: | 267 | case PERF_TYPE_HARDWARE: |
270 | ret = perf_evsel__hw_name(evsel, bf, size); | 268 | perf_evsel__hw_name(evsel, bf, sizeof(bf)); |
271 | break; | 269 | break; |
272 | 270 | ||
273 | case PERF_TYPE_HW_CACHE: | 271 | case PERF_TYPE_HW_CACHE: |
274 | ret = perf_evsel__hw_cache_name(evsel, bf, size); | 272 | perf_evsel__hw_cache_name(evsel, bf, sizeof(bf)); |
275 | break; | 273 | break; |
276 | 274 | ||
277 | case PERF_TYPE_SOFTWARE: | 275 | case PERF_TYPE_SOFTWARE: |
278 | ret = perf_evsel__sw_name(evsel, bf, size); | 276 | perf_evsel__sw_name(evsel, bf, sizeof(bf)); |
279 | break; | 277 | break; |
280 | 278 | ||
281 | case PERF_TYPE_TRACEPOINT: | 279 | case PERF_TYPE_TRACEPOINT: |
282 | ret = perf_evsel__tracepoint_name(evsel, bf, size); | 280 | scnprintf(bf, sizeof(bf), "%s", "unknown tracepoint"); |
283 | break; | 281 | break; |
284 | 282 | ||
285 | default: | 283 | default: |
286 | ret = scnprintf(bf, size, "%s", "unknown attr type"); | 284 | scnprintf(bf, sizeof(bf), "%s", "unknown attr type"); |
287 | break; | 285 | break; |
288 | } | 286 | } |
289 | 287 | ||
290 | return ret; | 288 | evsel->name = strdup(bf); |
289 | |||
290 | return evsel->name ?: "unknown"; | ||
291 | } | 291 | } |
292 | 292 | ||
293 | void perf_evsel__config(struct perf_evsel *evsel, struct perf_record_opts *opts, | 293 | void perf_evsel__config(struct perf_evsel *evsel, struct perf_record_opts *opts, |
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index 9ae64d9622bc..c936feb4e0a6 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h | |||
@@ -100,7 +100,7 @@ int __perf_evsel__hw_cache_name(u64 config, char *bf, size_t size); | |||
100 | const char *__perf_evsel__hw_name(u64 config); | 100 | const char *__perf_evsel__hw_name(u64 config); |
101 | const char *__perf_evsel__sw_name(u64 config); | 101 | const char *__perf_evsel__sw_name(u64 config); |
102 | 102 | ||
103 | int perf_evsel__name(struct perf_evsel *evsel, char *bf, size_t size); | 103 | const char *perf_evsel__name(struct perf_evsel *evsel); |
104 | 104 | ||
105 | int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads); | 105 | int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads); |
106 | int perf_evsel__alloc_id(struct perf_evsel *evsel, int ncpus, int nthreads); | 106 | int perf_evsel__alloc_id(struct perf_evsel *evsel, int ncpus, int nthreads); |
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 2dd5edf161b7..07c8f3792954 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -641,7 +641,7 @@ static int write_event_desc(int fd, struct perf_header *h __used, | |||
641 | /* | 641 | /* |
642 | * write event string as passed on cmdline | 642 | * write event string as passed on cmdline |
643 | */ | 643 | */ |
644 | ret = do_write_string(fd, event_name(attr)); | 644 | ret = do_write_string(fd, perf_evsel__name(attr)); |
645 | if (ret < 0) | 645 | if (ret < 0) |
646 | return ret; | 646 | return ret; |
647 | /* | 647 | /* |
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index d73690b11242..517e6473982c 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -201,13 +201,6 @@ const char *event_type(int type) | |||
201 | return "unknown"; | 201 | return "unknown"; |
202 | } | 202 | } |
203 | 203 | ||
204 | const char *event_name(struct perf_evsel *evsel) | ||
205 | { | ||
206 | static char bf[128]; | ||
207 | perf_evsel__name(evsel, bf, sizeof(bf)); | ||
208 | return bf; | ||
209 | } | ||
210 | |||
211 | const char *__event_name(int type, u64 config) | 204 | const char *__event_name(int type, u64 config) |
212 | { | 205 | { |
213 | static char buf[32]; | 206 | static char buf[32]; |
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index 8cac57ab4ee6..d7eb070937c4 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h | |||
@@ -26,7 +26,6 @@ extern struct tracepoint_path *tracepoint_id_to_path(u64 config); | |||
26 | extern bool have_tracepoints(struct list_head *evlist); | 26 | extern bool have_tracepoints(struct list_head *evlist); |
27 | 27 | ||
28 | const char *event_type(int type); | 28 | const char *event_type(int type); |
29 | const char *event_name(struct perf_evsel *event); | ||
30 | extern const char *__event_name(int type, u64 config); | 29 | extern const char *__event_name(int type, u64 config); |
31 | 30 | ||
32 | extern int parse_events_option(const struct option *opt, const char *str, | 31 | extern int parse_events_option(const struct option *opt, const char *str, |
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 2600916efa83..582ee38ed216 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -1439,7 +1439,7 @@ size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp) | |||
1439 | ret += hists__fprintf_nr_events(&session->hists, fp); | 1439 | ret += hists__fprintf_nr_events(&session->hists, fp); |
1440 | 1440 | ||
1441 | list_for_each_entry(pos, &session->evlist->entries, node) { | 1441 | list_for_each_entry(pos, &session->evlist->entries, node) { |
1442 | ret += fprintf(fp, "%s stats:\n", event_name(pos)); | 1442 | ret += fprintf(fp, "%s stats:\n", perf_evsel__name(pos)); |
1443 | ret += hists__fprintf_nr_events(&pos->hists, fp); | 1443 | ret += hists__fprintf_nr_events(&pos->hists, fp); |
1444 | } | 1444 | } |
1445 | 1445 | ||
diff --git a/tools/perf/util/top.c b/tools/perf/util/top.c index abe0e8e95068..7eeebcee291c 100644 --- a/tools/perf/util/top.c +++ b/tools/perf/util/top.c | |||
@@ -65,7 +65,7 @@ size_t perf_top__header_snprintf(struct perf_top *top, char *bf, size_t size) | |||
65 | top->freq ? "Hz" : ""); | 65 | top->freq ? "Hz" : ""); |
66 | } | 66 | } |
67 | 67 | ||
68 | ret += SNPRINTF(bf + ret, size - ret, "%s", event_name(top->sym_evsel)); | 68 | ret += SNPRINTF(bf + ret, size - ret, "%s", perf_evsel__name(top->sym_evsel)); |
69 | 69 | ||
70 | ret += SNPRINTF(bf + ret, size - ret, "], "); | 70 | ret += SNPRINTF(bf + ret, size - ret, "], "); |
71 | 71 | ||