aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-01-18 11:04:30 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-18 11:04:30 -0500
commitc6fa63c659b3dd121f21afe7529f505505e79b23 (patch)
tree1ad782e1fa623416efce7a6525248b54458d5f7c /tools/perf
parent34c682adb30e9602e92f044056c142f69b4a6cfe (diff)
parentad7f4e3f7b966ac09c8f98dbc5024813a1685775 (diff)
Merge branch 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: perf tools: Fix tracepoint id to string perf.data header table perf tools: Fix handling of wildcards in tracepoint event selectors powerpc: perf: Fix frequency calculation for overflowing counters
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/builtin-record.c2
-rw-r--r--tools/perf/util/parse-events.c31
2 files changed, 3 insertions, 30 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 5cb6f4bde905..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
493static 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
519static enum event_result parse_tracepoint_event(const char **strp, 493static enum event_result parse_tracepoint_event(const char **strp,
520 struct perf_event_attr *attr) 494 struct perf_event_attr *attr)
521{ 495{
@@ -555,13 +529,10 @@ static enum event_result parse_tracepoint_event(const char **strp,
555 if (evt_length >= MAX_EVENT_LENGTH) 529 if (evt_length >= MAX_EVENT_LENGTH)
556 return EVT_FAILED; 530 return EVT_FAILED;
557 if (strpbrk(evt_name, "*?")) { 531 if (strpbrk(evt_name, "*?")) {
558 *strp += strlen(sys_name) + evt_length; 532 *strp += strlen(sys_name) + evt_length + 1; /* 1 == the ':' */
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 }