diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-01-17 15:28:13 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-01-17 15:28:13 -0500 |
commit | ad7f4e3f7b966ac09c8f98dbc5024813a1685775 (patch) | |
tree | e5138e0e578670007744bd822ca40bf670ea995e /tools | |
parent | dd9a9ad5e1e94894433110ccbf492ed60d75ffcb (diff) |
perf tools: Fix tracepoint id to string perf.data header table
It was broken by f006d25 that passed just the event name, not the complete
sys:event that it expected to open the /sys/.../sys/sys:event/id file to get
the id.
Fix it by moving it to after parse_events in cmd_record, as at that point
we can just traverse the evsel_list and use evsel->attr.config +
event_name(evsel) instead of re-opening the /id file.
Reported-by: Franck Bui-Huu <vagabon.xyz@gmail.com>
Cc: Franck Bui-Huu <vagabon.xyz@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Han Pingtian <phan@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <20110117202801.GG2085@ghostprotocols.net>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-record.c | 2 | ||||
-rw-r--r-- | tools/perf/util/parse-events.c | 29 |
2 files changed, 2 insertions, 29 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index df6064ad9bf2..fcd29e8af29f 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -936,6 +936,8 @@ int cmd_record(int argc, const char **argv, const char *prefix __used) | |||
936 | list_for_each_entry(pos, &evsel_list, node) { | 936 | list_for_each_entry(pos, &evsel_list, node) { |
937 | if (perf_evsel__alloc_fd(pos, cpus->nr, threads->nr) < 0) | 937 | if (perf_evsel__alloc_fd(pos, cpus->nr, threads->nr) < 0) |
938 | goto out_free_fd; | 938 | goto out_free_fd; |
939 | if (perf_header__push_event(pos->attr.config, event_name(pos))) | ||
940 | goto out_free_fd; | ||
939 | } | 941 | } |
940 | event_array = malloc((sizeof(struct pollfd) * MAX_NR_CPUS * | 942 | event_array = malloc((sizeof(struct pollfd) * MAX_NR_CPUS * |
941 | MAX_COUNTERS * threads->nr)); | 943 | MAX_COUNTERS * threads->nr)); |
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 1f4cfe5d32fc..bc2732ee23eb 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -490,32 +490,6 @@ parse_multiple_tracepoint_event(char *sys_name, const char *evt_exp, | |||
490 | return EVT_HANDLED_ALL; | 490 | return EVT_HANDLED_ALL; |
491 | } | 491 | } |
492 | 492 | ||
493 | static int store_event_type(const char *orgname) | ||
494 | { | ||
495 | char filename[PATH_MAX], *c; | ||
496 | FILE *file; | ||
497 | int id, n; | ||
498 | |||
499 | sprintf(filename, "%s/", debugfs_path); | ||
500 | strncat(filename, orgname, strlen(orgname)); | ||
501 | strcat(filename, "/id"); | ||
502 | |||
503 | c = strchr(filename, ':'); | ||
504 | if (c) | ||
505 | *c = '/'; | ||
506 | |||
507 | file = fopen(filename, "r"); | ||
508 | if (!file) | ||
509 | return 0; | ||
510 | n = fscanf(file, "%i", &id); | ||
511 | fclose(file); | ||
512 | if (n < 1) { | ||
513 | pr_err("cannot store event ID\n"); | ||
514 | return -EINVAL; | ||
515 | } | ||
516 | return perf_header__push_event(id, orgname); | ||
517 | } | ||
518 | |||
519 | static enum event_result parse_tracepoint_event(const char **strp, | 493 | static enum event_result parse_tracepoint_event(const char **strp, |
520 | struct perf_event_attr *attr) | 494 | struct perf_event_attr *attr) |
521 | { | 495 | { |
@@ -559,9 +533,6 @@ static enum event_result parse_tracepoint_event(const char **strp, | |||
559 | return parse_multiple_tracepoint_event(sys_name, evt_name, | 533 | return parse_multiple_tracepoint_event(sys_name, evt_name, |
560 | flags); | 534 | flags); |
561 | } else { | 535 | } else { |
562 | if (store_event_type(evt_name) < 0) | ||
563 | return EVT_FAILED; | ||
564 | |||
565 | return parse_single_tracepoint_event(sys_name, evt_name, | 536 | return parse_single_tracepoint_event(sys_name, evt_name, |
566 | evt_length, attr, strp); | 537 | evt_length, attr, strp); |
567 | } | 538 | } |