aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2014-08-15 15:08:40 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2014-09-17 16:08:08 -0400
commitad96227349901838e1a7f96f1dc22d96a97520c0 (patch)
tree57fc191394188bd76929821d6fe2accb28b3cad5
parent6997af72e6c1e9d8c1cc511dc9485e9ee69a5e20 (diff)
perf tools: Let a user specify a PMU event without any config terms
This enables a PMU event to be specified in the form: pmu// which is effectively the same as: pmu/config=0/ This patch is a precursor to defining default config for a PMU. Further explanation extracted from lkml thread: Imagine that the 'tsc' term did not exist. Intel PT trace data would not contain TSC packets, and the decoder would not know how to decode them. Then imagine that a new version of the hardware adds 'tsc'. It is such a useful feature that we want it by default, but older versions of the tools don't know how to decode it, so the kernel cannot turn it on by default. It is similar to why the kernel does not select perf_event_attr.mmap2 by default. The kernel doesn't know whether the tool supports it. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1408129739-17368-6-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/util/parse-events.c6
-rw-r--r--tools/perf/util/parse-events.y10
2 files changed, 16 insertions, 0 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index e34c81a0bcf3..e75628813968 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -645,6 +645,12 @@ int parse_events_add_pmu(struct list_head *list, int *idx,
645 645
646 memset(&attr, 0, sizeof(attr)); 646 memset(&attr, 0, sizeof(attr));
647 647
648 if (!head_config) {
649 attr.type = pmu->type;
650 evsel = __add_event(list, idx, &attr, NULL, pmu->cpus);
651 return evsel ? 0 : -ENOMEM;
652 }
653
648 if (perf_pmu__check_alias(pmu, head_config, &unit, &scale)) 654 if (perf_pmu__check_alias(pmu, head_config, &unit, &scale))
649 return -EINVAL; 655 return -EINVAL;
650 656
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index 0bc87ba46bf3..55fab6ad609a 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -210,6 +210,16 @@ PE_NAME '/' event_config '/'
210 parse_events__free_terms($3); 210 parse_events__free_terms($3);
211 $$ = list; 211 $$ = list;
212} 212}
213|
214PE_NAME '/' '/'
215{
216 struct parse_events_evlist *data = _data;
217 struct list_head *list;
218
219 ALLOC_LIST(list);
220 ABORT_ON(parse_events_add_pmu(list, &data->idx, $1, NULL));
221 $$ = list;
222}
213 223
214value_sym: 224value_sym:
215PE_VALUE_SYM_HW 225PE_VALUE_SYM_HW