diff options
Diffstat (limited to 'tools/perf/util/parse-events.c')
| -rw-r--r-- | tools/perf/util/parse-events.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 8cfb48cbbea0..b097570e9623 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
| @@ -8,9 +8,10 @@ | |||
| 8 | #include "cache.h" | 8 | #include "cache.h" |
| 9 | #include "header.h" | 9 | #include "header.h" |
| 10 | 10 | ||
| 11 | int nr_counters; | 11 | int nr_counters; |
| 12 | 12 | ||
| 13 | struct perf_event_attr attrs[MAX_COUNTERS]; | 13 | struct perf_event_attr attrs[MAX_COUNTERS]; |
| 14 | char *filters[MAX_COUNTERS]; | ||
| 14 | 15 | ||
| 15 | struct event_symbol { | 16 | struct event_symbol { |
| 16 | u8 type; | 17 | u8 type; |
| @@ -708,7 +709,6 @@ static void store_event_type(const char *orgname) | |||
| 708 | perf_header__push_event(id, orgname); | 709 | perf_header__push_event(id, orgname); |
| 709 | } | 710 | } |
| 710 | 711 | ||
| 711 | |||
| 712 | int parse_events(const struct option *opt __used, const char *str, int unset __used) | 712 | int parse_events(const struct option *opt __used, const char *str, int unset __used) |
| 713 | { | 713 | { |
| 714 | struct perf_event_attr attr; | 714 | struct perf_event_attr attr; |
| @@ -745,6 +745,28 @@ int parse_events(const struct option *opt __used, const char *str, int unset __u | |||
| 745 | return 0; | 745 | return 0; |
| 746 | } | 746 | } |
| 747 | 747 | ||
| 748 | int parse_filter(const struct option *opt __used, const char *str, | ||
| 749 | int unset __used) | ||
| 750 | { | ||
| 751 | int i = nr_counters - 1; | ||
| 752 | int len = strlen(str); | ||
| 753 | |||
| 754 | if (i < 0 || attrs[i].type != PERF_TYPE_TRACEPOINT) { | ||
| 755 | fprintf(stderr, | ||
| 756 | "-F option should follow a -e tracepoint option\n"); | ||
| 757 | return -1; | ||
| 758 | } | ||
| 759 | |||
| 760 | filters[i] = malloc(len + 1); | ||
| 761 | if (!filters[i]) { | ||
| 762 | fprintf(stderr, "not enough memory to hold filter string\n"); | ||
| 763 | return -1; | ||
| 764 | } | ||
| 765 | strcpy(filters[i], str); | ||
| 766 | |||
| 767 | return 0; | ||
| 768 | } | ||
| 769 | |||
| 748 | static const char * const event_type_descriptors[] = { | 770 | static const char * const event_type_descriptors[] = { |
| 749 | "", | 771 | "", |
| 750 | "Hardware event", | 772 | "Hardware event", |
