diff options
author | Jiri Olsa <jolsa@redhat.com> | 2012-05-21 03:12:53 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-05-22 10:47:54 -0400 |
commit | 6b5fc39bdd781711d7da8b95ae0243df3b35c5bf (patch) | |
tree | 95b7a6062e5170da6121cd8486b0e4c7a921cf70 /tools/perf/util/parse-events-test.c | |
parent | 08d2f762ac4af861b962e543fceab341f05c8886 (diff) |
perf tools: Add hardcoded name term for pmu events
Adding a new hardcoded term 'name' allowing to specify a name for the
pmu event. The term is defined along with standard pmu terms. If no
'name' term is given, the event name follows following template:
"raw 0x<perf_event_attr::config>"
running:
perf stat -e cpu/config=1,name=krava1/u ls
will produce following output:
...
Performance counter stats for 'ls':
0 krava1
...
running:
perf stat -e cpu/config=1/u ls
will produce following output:
...
Performance counter stats for 'ls':
0 raw 0x1
...
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1337584373-2741-6-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/parse-events-test.c')
-rw-r--r-- | tools/perf/util/parse-events-test.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/perf/util/parse-events-test.c b/tools/perf/util/parse-events-test.c index 2e8f435384a6..76b98e2a587d 100644 --- a/tools/perf/util/parse-events-test.c +++ b/tools/perf/util/parse-events-test.c | |||
@@ -409,6 +409,27 @@ static int test__checkevent_list(struct perf_evlist *evlist) | |||
409 | return 0; | 409 | return 0; |
410 | } | 410 | } |
411 | 411 | ||
412 | static int test__checkevent_pmu_name(struct perf_evlist *evlist) | ||
413 | { | ||
414 | struct perf_evsel *evsel; | ||
415 | |||
416 | /* cpu/config=1,name=krava1/u */ | ||
417 | evsel = list_entry(evlist->entries.next, struct perf_evsel, node); | ||
418 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); | ||
419 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type); | ||
420 | TEST_ASSERT_VAL("wrong config", 1 == evsel->attr.config); | ||
421 | TEST_ASSERT_VAL("wrong name", !strcmp(evsel->name, "krava")); | ||
422 | |||
423 | /* cpu/config=2/" */ | ||
424 | evsel = list_entry(evsel->node.next, struct perf_evsel, node); | ||
425 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); | ||
426 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type); | ||
427 | TEST_ASSERT_VAL("wrong config", 2 == evsel->attr.config); | ||
428 | TEST_ASSERT_VAL("wrong name", !strcmp(evsel->name, "raw 0x2")); | ||
429 | |||
430 | return 0; | ||
431 | } | ||
432 | |||
412 | struct test__event_st { | 433 | struct test__event_st { |
413 | const char *name; | 434 | const char *name; |
414 | __u32 type; | 435 | __u32 type; |
@@ -529,6 +550,10 @@ static struct test__event_st test__events_pmu[] = { | |||
529 | .name = "cpu/config=10,config1,config2=3,period=1000/u", | 550 | .name = "cpu/config=10,config1,config2=3,period=1000/u", |
530 | .check = test__checkevent_pmu, | 551 | .check = test__checkevent_pmu, |
531 | }, | 552 | }, |
553 | [1] = { | ||
554 | .name = "cpu/config=1,name=krava/u,cpu/config=2/u", | ||
555 | .check = test__checkevent_pmu_name, | ||
556 | }, | ||
532 | }; | 557 | }; |
533 | 558 | ||
534 | #define TEST__EVENTS_PMU_CNT (sizeof(test__events_pmu) / \ | 559 | #define TEST__EVENTS_PMU_CNT (sizeof(test__events_pmu) / \ |