diff options
author | Jiri Olsa <jolsa@redhat.com> | 2012-03-15 20:09:18 +0100 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-03-16 14:30:13 -0300 |
commit | 5f537a26590e696466aae7f41e6b77e92c8486d1 (patch) | |
tree | 6946ba5b2a4cc1133ab11d8a81c37465f794e655 /tools/perf/util/parse-events.c | |
parent | cd82a32e9924d3a82bd27f830755d23e4ded25bc (diff) | |
download | talos-obmc-linux-5f537a26590e696466aae7f41e6b77e92c8486d1.tar.gz talos-obmc-linux-5f537a26590e696466aae7f41e6b77e92c8486d1.zip |
perf tools: Add support to specify pmu style event
Added new event rule to the event definition grammar:
event_def: event_pmu |
...
event_pmu: PE_NAME '/' event_config '/'
Using this rule, event could be now specified like:
cpu/config=1,config1=2,config2=3/u
where pmu name 'cpu' is looked up via following path:
${sysfs_mount}/bus/event_source/devices/${pmu}
and config options are bound to the pmu's format definiton:
${sysfs_mount}/bus/event_source/devices/${pmu}/format
The hardcoded config options still stays and have precedence
over any format field defined with same name.
Acked-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/n/tip-50d8nr94f8k4wkezutrxvthe@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/parse-events.c')
-rw-r--r-- | tools/perf/util/parse-events.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 59f5cf64ef70..bec1cc6a1f38 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -12,6 +12,7 @@ #include "header.h" #include "debugfs.h" #include "parse-events-flex.h" +#include "pmu.h" #define MAX_NAME_LEN 100 @@ -646,6 +647,30 @@ int parse_events_add_numeric(struct list_head *list, int *idx, (char *) __event_name(type, config)); } +int parse_events_add_pmu(struct list_head *list, int *idx, + char *name, struct list_head *head_config) +{ + struct perf_event_attr attr; + struct perf_pmu *pmu; + + pmu = perf_pmu__find(name); + if (!pmu) + return -EINVAL; + + memset(&attr, 0, sizeof(attr)); + + /* + * Configure hardcoded terms first, no need to check + * return value when called with fail == 0 ;) + */ + config_attr(&attr, head_config, 0); + + if (perf_pmu__config(pmu, &attr, head_config)) + return -EINVAL; + + return add_event(list, idx, &attr, (char *) "pmu"); +} + int parse_events_modifier(struct list_head *list, char *str) { struct perf_evsel *evsel; @@ -957,8 +982,12 @@ void print_events(const char *event_glob) printf("\n"); printf(" %-50s [%s]\n", - "rNNN (see 'perf list --help' on how to encode it)", + "rNNN", + event_type_descriptors[PERF_TYPE_RAW]); + printf(" %-50s [%s]\n", + "cpu/t1=v1[,t2=v2,t3 ...]/modifier", event_type_descriptors[PERF_TYPE_RAW]); + printf(" (see 'perf list --help' on how to encode it)\n"); printf("\n"); printf(" %-50s [%s]\n", |