aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-test.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-03-15 15:09:16 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-03-16 13:26:06 -0400
commit8f707d843c2f4023490a873dbc182f632a3a5906 (patch)
treee4c6d509756aa869314888de0d5873c4a20a7e92 /tools/perf/builtin-test.c
parent89812fc81f8d62d70433a8ff63d26819f372e8ec (diff)
perf tools: Add config options support for event parsing
Adding a new rule to the event grammar to be able to specify values of additional attributes of symbolic event. The new syntax for event symbolic definition is: event_legacy_symbol: PE_NAME_SYM '/' event_config '/' | PE_NAME_SYM sep_slash_dc event_config: event_config ',' event_term | event_term event_term: PE_NAME '=' PE_NAME | PE_NAME '=' PE_VALUE PE_NAME sep_slash_dc: '/' | ':' | At the moment the config options are hardcoded to be used for legacy symbol events to define several perf_event_attr fields. It is: 'config' to define perf_event_attr::config 'config1' to define perf_event_attr::config1 'config2' to define perf_event_attr::config2 'period' to define perf_event_attr::sample_period Legacy events could be now specified as: cycles/period=100000/ If term is specified without the value assignment, then 1 is assigned by default. Acked-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Jiri Olsa <jolsa@redhat.com> Link: http://lkml.kernel.org/n/tip-mgkavww9790jbt2jdkooyv4q@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-test.c')
-rw-r--r--tools/perf/builtin-test.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index 844c53a49a5a..8b5359506505 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -677,6 +677,24 @@ static int test__checkevent_symbolic_name(struct perf_evlist *evlist)
677 return 0; 677 return 0;
678} 678}
679 679
680static int test__checkevent_symbolic_name_config(struct perf_evlist *evlist)
681{
682 struct perf_evsel *evsel = list_entry(evlist->entries.next,
683 struct perf_evsel, node);
684
685 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
686 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type);
687 TEST_ASSERT_VAL("wrong config",
688 PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config);
689 TEST_ASSERT_VAL("wrong period",
690 100000 == evsel->attr.sample_period);
691 TEST_ASSERT_VAL("wrong config1",
692 0 == evsel->attr.config1);
693 TEST_ASSERT_VAL("wrong config2",
694 1 == evsel->attr.config2);
695 return 0;
696}
697
680static int test__checkevent_symbolic_alias(struct perf_evlist *evlist) 698static int test__checkevent_symbolic_alias(struct perf_evlist *evlist)
681{ 699{
682 struct perf_evsel *evsel = list_entry(evlist->entries.next, 700 struct perf_evsel *evsel = list_entry(evlist->entries.next,
@@ -884,6 +902,10 @@ static struct test__event_st {
884 .check = test__checkevent_symbolic_name, 902 .check = test__checkevent_symbolic_name,
885 }, 903 },
886 { 904 {
905 .name = "cycles/period=100000,config2/",
906 .check = test__checkevent_symbolic_name_config,
907 },
908 {
887 .name = "faults", 909 .name = "faults",
888 .check = test__checkevent_symbolic_alias, 910 .check = test__checkevent_symbolic_alias,
889 }, 911 },