* [RFC 0/3] perf stat: improvements for handling of multiple PMUs @ 2018-02-27 22:34 Agustin Vega-Frias 2018-02-27 22:34 ` [RFC 1/3] perf, tools: Support wildcards on pmu name in dynamic pmu events Agustin Vega-Frias ` (2 more replies) 0 siblings, 3 replies; 8+ messages in thread From: Agustin Vega-Frias @ 2018-02-27 22:34 UTC (permalink / raw) To: linux-arm-kernel This series of patches adds some simple improvements to the way perf stat handles PMUs that have multiple instances by: 1. Adding glob-like matching in addition to the prefix-based matching introduced previously (patch 1). 2. Adding the ability to recover the PMU names when printing the events separately with the --no-merge option (patch 2). 3. Restoring auto-merge for events created by prefix or glob-like match (patch 3). Note that this still keeps the behavior that disables auto-merging of legacy symbolic events (e.g. cycles). Agustin Vega-Frias (3): perf, tools: Support wildcards on pmu name in dynamic pmu events perf, tools: Display pmu name when printing unmerged events in stat perf pmu: Restore auto-merging of PMU events created by prefix match tools/perf/builtin-stat.c | 29 ++++++++++++++++++++++++++++- tools/perf/util/evsel.c | 1 + tools/perf/util/evsel.h | 1 + tools/perf/util/parse-events.c | 21 ++++++++++----------- tools/perf/util/parse-events.h | 2 +- tools/perf/util/parse-events.l | 2 +- tools/perf/util/parse-events.y | 7 ++++--- 7 files changed, 46 insertions(+), 17 deletions(-) -- 2.7.4 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [RFC 1/3] perf, tools: Support wildcards on pmu name in dynamic pmu events 2018-02-27 22:34 [RFC 0/3] perf stat: improvements for handling of multiple PMUs Agustin Vega-Frias @ 2018-02-27 22:34 ` Agustin Vega-Frias 2018-02-27 23:05 ` Andi Kleen 2018-02-27 22:34 ` [RFC 2/3] perf, tools: Display pmu name when printing unmerged events in stat Agustin Vega-Frias 2018-02-27 22:34 ` [RFC 3/3] perf pmu: Restore auto-merging of PMU events created by prefix match Agustin Vega-Frias 2 siblings, 1 reply; 8+ messages in thread From: Agustin Vega-Frias @ 2018-02-27 22:34 UTC (permalink / raw) To: linux-arm-kernel Starting on v4.12 event parsing code for dynamic pmu events already supports prefix-based matching of multiple pmus when creating dynamic events. E.g., in a system with the following dynamic pmus: mypmu_0 mypmu_1 mypmu_2 mypmu_4 passing mypmu/<config>/ as an event spec will result in the creation of the event in all of the pmus. This change expands this matching through the use of fnmatch so glob-like expressions can be used to create events in multiple pmus. E.g., in the system described above if a user only wants to create the event in mypmu_0 and mypmu_1, mypmu_[01]/<config>/ can be passed. Signed-off-by: Agustin Vega-Frias <agustinv@codeaurora.org> --- tools/perf/util/parse-events.l | 2 +- tools/perf/util/parse-events.y | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l index 655ecff..a1a01b1 100644 --- a/tools/perf/util/parse-events.l +++ b/tools/perf/util/parse-events.l @@ -175,7 +175,7 @@ bpf_source [^,{}]+\.c[a-zA-Z0-9._]* num_dec [0-9]+ num_hex 0x[a-fA-F0-9]+ num_raw_hex [a-fA-F0-9]+ -name [a-zA-Z_*?][a-zA-Z0-9_*?.]* +name [a-zA-Z_*?\[\]][a-zA-Z0-9_*?.\[\]]* name_minus [a-zA-Z_*?][a-zA-Z0-9\-_*?.:]* drv_cfg_term [a-zA-Z0-9_\.]+(=[a-zA-Z0-9_*?\.:]+)? /* If you add a modifier you need to update check_modifier() */ diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y index e81a20e..c528469 100644 --- a/tools/perf/util/parse-events.y +++ b/tools/perf/util/parse-events.y @@ -8,6 +8,7 @@ #define YYDEBUG 1 +#include <fnmatch.h> #include <linux/compiler.h> #include <linux/list.h> #include <linux/types.h> @@ -241,7 +242,7 @@ PE_NAME opt_event_config if (!strncmp(name, "uncore_", 7) && strncmp($1, "uncore_", 7)) name += 7; - if (!strncmp($1, name, strlen($1))) { + if (!strncmp($1, name, strlen($1)) || !fnmatch($1, name, 0)) { if (parse_events_copy_term_list(orig_terms, &terms)) YYABORT; if (!parse_events_add_pmu(_parse_state, list, pmu->name, terms)) -- 2.7.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [RFC 1/3] perf, tools: Support wildcards on pmu name in dynamic pmu events 2018-02-27 22:34 ` [RFC 1/3] perf, tools: Support wildcards on pmu name in dynamic pmu events Agustin Vega-Frias @ 2018-02-27 23:05 ` Andi Kleen 0 siblings, 0 replies; 8+ messages in thread From: Andi Kleen @ 2018-02-27 23:05 UTC (permalink / raw) To: linux-arm-kernel On Tue, Feb 27, 2018 at 05:34:06PM -0500, Agustin Vega-Frias wrote: > Starting on v4.12 event parsing code for dynamic pmu events already > supports prefix-based matching of multiple pmus when creating dynamic > events. E.g., in a system with the following dynamic pmus: > > mypmu_0 > mypmu_1 > mypmu_2 > mypmu_4 > > passing mypmu/<config>/ as an event spec will result in the creation > of the event in all of the pmus. This change expands this matching > through the use of fnmatch so glob-like expressions can be used to > create events in multiple pmus. E.g., in the system described above > if a user only wants to create the event in mypmu_0 and mypmu_1, > mypmu_[01]/<config>/ can be passed. Missing documentation for the globbing. The rest looked ok to me. Reviewed-by: Andi Kleen <ak@linux.intel.com> -Andi ^ permalink raw reply [flat|nested] 8+ messages in thread
* [RFC 2/3] perf, tools: Display pmu name when printing unmerged events in stat 2018-02-27 22:34 [RFC 0/3] perf stat: improvements for handling of multiple PMUs Agustin Vega-Frias 2018-02-27 22:34 ` [RFC 1/3] perf, tools: Support wildcards on pmu name in dynamic pmu events Agustin Vega-Frias @ 2018-02-27 22:34 ` Agustin Vega-Frias 2018-02-27 22:34 ` [RFC 3/3] perf pmu: Restore auto-merging of PMU events created by prefix match Agustin Vega-Frias 2 siblings, 0 replies; 8+ messages in thread From: Agustin Vega-Frias @ 2018-02-27 22:34 UTC (permalink / raw) To: linux-arm-kernel Starting on v4.12 event parsing code for dynamic pmu events supports prefix-based matching of multiple pmus when creating dynamic events. E.g., in a system with the following dynamic pmus: l3cache_0_0 l3cache_0_1 l3cache_0_2 l3cache_0_3 passing l3cache/<config>/ as an event spec will result in the creation of the event in all of the pmus. When this functionality is used in stat the command will by default merge the event counts and display a single value. E.g.: ./perf stat -a -e l3cache/read-miss/ ls > /dev/null Performance counter stats for 'system wide': 328 l3cache/read-miss/ 0.001661809 seconds time elapsed JSON-based alias events behave in the same way: $ ./perf stat -a -e l3cache_read_miss ls > /dev/null Performance counter stats for 'system wide': 229 l3cache_read_miss 0.001656099 seconds time elapsed This behavior can be disabled by the --no-merge option but the real pmu name is lost and it's not possible to see which count corresponds to which pmu: $ ./perf stat -a -e l3cache/read-miss/ --no-merge ls > /dev/null Performance counter stats for 'system wide': 67 l3cache/read-miss/ 67 l3cache/read-miss/ 63 l3cache/read-miss/ 60 l3cache/read-miss/ 0.001675706 seconds time elapsed This is also the case for alias events, e.g.: $ ./perf stat -a -e l3cache_read_miss --no-merge ls > /dev/null Performance counter stats for 'system wide': 12 l3cache_read_miss 17 l3cache_read_miss 10 l3cache_read_miss 8 l3cache_read_miss 0.001661305 seconds time elapsed This change adds the original pmu name to the event. For dynamic pmu events the pmu name is restored in the event name: $ ./perf stat -a -e l3cache/read-miss/ --no-merge ls > /dev/null Performance counter stats for 'system wide': 63 l3cache_0_3/read-miss/ 74 l3cache_0_1/read-miss/ 64 l3cache_0_2/read-miss/ 74 l3cache_0_0/read-miss/ 0.001675706 seconds time elapsed For alias events the name is added after the event name: $ ./perf stat -a -e l3cache_read_miss --no-merge ls > /dev/null Performance counter stats for 'system wide': 10 l3cache_read_miss [l3cache_0_3] 12 l3cache_read_miss [l3cache_0_1] 10 l3cache_read_miss [l3cache_0_2] 17 l3cache_read_miss [l3cache_0_0] 0.001661305 seconds time elapsed Signed-off-by: Agustin Vega-Frias <agustinv@codeaurora.org> --- tools/perf/builtin-stat.c | 29 ++++++++++++++++++++++++++++- tools/perf/util/evsel.c | 1 + tools/perf/util/evsel.h | 1 + tools/perf/util/parse-events.c | 8 +++++++- 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 98bf9d3..d196972 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -1225,6 +1225,31 @@ static void aggr_update_shadow(void) } } +static void uniquify_event_name(struct perf_evsel *counter) +{ + char *new_name; + char *config; + + if (!counter->pmu_name || !strncmp(counter->name, counter->pmu_name, + strlen(counter->pmu_name))) + return; + + config = strchr(counter->name, '/'); + if (config) { + if (asprintf(&new_name, + "%s%s", counter->pmu_name, config) > 0) { + free(counter->name); + counter->name = new_name; + } + } else { + if (asprintf(&new_name, + "%s [%s]", counter->name, counter->pmu_name) > 0) { + free(counter->name); + counter->name = new_name; + } + } +} + static void collect_all_aliases(struct perf_evsel *counter, void (*cb)(struct perf_evsel *counter, void *data, bool first), @@ -1253,7 +1278,9 @@ static bool collect_data(struct perf_evsel *counter, if (counter->merged_stat) return false; cb(counter, data, true); - if (!no_merge && counter->auto_merge_stats) + if (no_merge) + uniquify_event_name(counter); + else if (counter->auto_merge_stats) collect_all_aliases(counter, cb, data); return true; } diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index ef35168..4841000 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -244,6 +244,7 @@ void perf_evsel__init(struct perf_evsel *evsel, evsel->metric_name = NULL; evsel->metric_events = NULL; evsel->collect_stat = false; + evsel->pmu_name = NULL; } struct perf_evsel *perf_evsel__new_idx(struct perf_event_attr *attr, int idx) diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index a7487c6..c2ac16a 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h @@ -142,6 +142,7 @@ struct perf_evsel { struct perf_evsel **metric_events; bool collect_stat; bool weak_group; + const char *pmu_name; }; union u64_swap { diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 34589c4..bafc91e 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -1247,7 +1247,12 @@ static int __parse_events_add_pmu(struct parse_events_state *parse_state, if (!head_config) { attr.type = pmu->type; evsel = __add_event(list, &parse_state->idx, &attr, NULL, pmu, NULL, auto_merge_stats); - return evsel ? 0 : -ENOMEM; + if (evsel) { + evsel->pmu_name = name; + return 0; + } else { + return -ENOMEM; + } } if (perf_pmu__check_alias(pmu, head_config, &info)) @@ -1276,6 +1281,7 @@ static int __parse_events_add_pmu(struct parse_events_state *parse_state, evsel->snapshot = info.snapshot; evsel->metric_expr = info.metric_expr; evsel->metric_name = info.metric_name; + evsel->pmu_name = name; } return evsel ? 0 : -ENOMEM; -- 2.7.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [RFC 3/3] perf pmu: Restore auto-merging of PMU events created by prefix match 2018-02-27 22:34 [RFC 0/3] perf stat: improvements for handling of multiple PMUs Agustin Vega-Frias 2018-02-27 22:34 ` [RFC 1/3] perf, tools: Support wildcards on pmu name in dynamic pmu events Agustin Vega-Frias 2018-02-27 22:34 ` [RFC 2/3] perf, tools: Display pmu name when printing unmerged events in stat Agustin Vega-Frias @ 2018-02-27 22:34 ` Agustin Vega-Frias 2018-02-28 9:40 ` Jiri Olsa 2 siblings, 1 reply; 8+ messages in thread From: Agustin Vega-Frias @ 2018-02-27 22:34 UTC (permalink / raw) To: linux-arm-kernel This was disabled when auto-merging of non-alias events was disabled in commit 63ce844 (perf stat: Only auto-merge events that are PMU aliases). Signed-off-by: Agustin Vega-Frias <agustinv@codeaurora.org> --- tools/perf/util/parse-events.c | 13 +++---------- tools/perf/util/parse-events.h | 2 +- tools/perf/util/parse-events.y | 4 ++-- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index bafc91e..4e80ca3 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -1217,7 +1217,7 @@ int parse_events_add_numeric(struct parse_events_state *parse_state, get_config_name(head_config), &config_terms); } -static int __parse_events_add_pmu(struct parse_events_state *parse_state, +int parse_events_add_pmu(struct parse_events_state *parse_state, struct list_head *list, char *name, struct list_head *head_config, bool auto_merge_stats) { @@ -1287,13 +1287,6 @@ static int __parse_events_add_pmu(struct parse_events_state *parse_state, return evsel ? 0 : -ENOMEM; } -int parse_events_add_pmu(struct parse_events_state *parse_state, - struct list_head *list, char *name, - struct list_head *head_config) -{ - return __parse_events_add_pmu(parse_state, list, name, head_config, false); -} - int parse_events_multi_pmu_add(struct parse_events_state *parse_state, char *str, struct list_head **listp) { @@ -1323,8 +1316,8 @@ int parse_events_multi_pmu_add(struct parse_events_state *parse_state, return -1; list_add_tail(&term->list, head); - if (!__parse_events_add_pmu(parse_state, list, - pmu->name, head, true)) { + if (!parse_events_add_pmu(parse_state, list, + pmu->name, head, true)) { pr_debug("%s -> %s/%s/\n", str, pmu->name, alias->str); ok++; diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index 88108cd..5015cfd 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h @@ -167,7 +167,7 @@ int parse_events_add_breakpoint(struct list_head *list, int *idx, void *ptr, char *type, u64 len); int parse_events_add_pmu(struct parse_events_state *parse_state, struct list_head *list, char *name, - struct list_head *head_config); + struct list_head *head_config, bool auto_merge_stats); int parse_events_multi_pmu_add(struct parse_events_state *parse_state, char *str, diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y index c528469..b51278f 100644 --- a/tools/perf/util/parse-events.y +++ b/tools/perf/util/parse-events.y @@ -232,7 +232,7 @@ PE_NAME opt_event_config YYABORT; ALLOC_LIST(list); - if (parse_events_add_pmu(_parse_state, list, $1, $2)) { + if (parse_events_add_pmu(_parse_state, list, $1, $2, false)) { struct perf_pmu *pmu = NULL; int ok = 0; @@ -245,7 +245,7 @@ PE_NAME opt_event_config if (!strncmp($1, name, strlen($1)) || !fnmatch($1, name, 0)) { if (parse_events_copy_term_list(orig_terms, &terms)) YYABORT; - if (!parse_events_add_pmu(_parse_state, list, pmu->name, terms)) + if (!parse_events_add_pmu(_parse_state, list, pmu->name, terms, true)) ok++; parse_events_terms__delete(terms); } -- 2.7.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [RFC 3/3] perf pmu: Restore auto-merging of PMU events created by prefix match 2018-02-27 22:34 ` [RFC 3/3] perf pmu: Restore auto-merging of PMU events created by prefix match Agustin Vega-Frias @ 2018-02-28 9:40 ` Jiri Olsa 2018-02-28 12:45 ` Arnaldo Carvalho de Melo 0 siblings, 1 reply; 8+ messages in thread From: Jiri Olsa @ 2018-02-28 9:40 UTC (permalink / raw) To: linux-arm-kernel On Tue, Feb 27, 2018 at 05:34:08PM -0500, Agustin Vega-Frias wrote: > This was disabled when auto-merging of non-alias events was disabled in > commit 63ce844 (perf stat: Only auto-merge events that are PMU aliases). this changes the output, right? please provide before/after output thanks, jirka > > Signed-off-by: Agustin Vega-Frias <agustinv@codeaurora.org> > --- > tools/perf/util/parse-events.c | 13 +++---------- > tools/perf/util/parse-events.h | 2 +- > tools/perf/util/parse-events.y | 4 ++-- > 3 files changed, 6 insertions(+), 13 deletions(-) > > diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c > index bafc91e..4e80ca3 100644 > --- a/tools/perf/util/parse-events.c > +++ b/tools/perf/util/parse-events.c > @@ -1217,7 +1217,7 @@ int parse_events_add_numeric(struct parse_events_state *parse_state, > get_config_name(head_config), &config_terms); > } > > -static int __parse_events_add_pmu(struct parse_events_state *parse_state, > +int parse_events_add_pmu(struct parse_events_state *parse_state, > struct list_head *list, char *name, > struct list_head *head_config, bool auto_merge_stats) > { > @@ -1287,13 +1287,6 @@ static int __parse_events_add_pmu(struct parse_events_state *parse_state, > return evsel ? 0 : -ENOMEM; > } > > -int parse_events_add_pmu(struct parse_events_state *parse_state, > - struct list_head *list, char *name, > - struct list_head *head_config) > -{ > - return __parse_events_add_pmu(parse_state, list, name, head_config, false); > -} > - > int parse_events_multi_pmu_add(struct parse_events_state *parse_state, > char *str, struct list_head **listp) > { > @@ -1323,8 +1316,8 @@ int parse_events_multi_pmu_add(struct parse_events_state *parse_state, > return -1; > list_add_tail(&term->list, head); > > - if (!__parse_events_add_pmu(parse_state, list, > - pmu->name, head, true)) { > + if (!parse_events_add_pmu(parse_state, list, > + pmu->name, head, true)) { > pr_debug("%s -> %s/%s/\n", str, > pmu->name, alias->str); > ok++; > diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h > index 88108cd..5015cfd 100644 > --- a/tools/perf/util/parse-events.h > +++ b/tools/perf/util/parse-events.h > @@ -167,7 +167,7 @@ int parse_events_add_breakpoint(struct list_head *list, int *idx, > void *ptr, char *type, u64 len); > int parse_events_add_pmu(struct parse_events_state *parse_state, > struct list_head *list, char *name, > - struct list_head *head_config); > + struct list_head *head_config, bool auto_merge_stats); > > int parse_events_multi_pmu_add(struct parse_events_state *parse_state, > char *str, > diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y > index c528469..b51278f 100644 > --- a/tools/perf/util/parse-events.y > +++ b/tools/perf/util/parse-events.y > @@ -232,7 +232,7 @@ PE_NAME opt_event_config > YYABORT; > > ALLOC_LIST(list); > - if (parse_events_add_pmu(_parse_state, list, $1, $2)) { > + if (parse_events_add_pmu(_parse_state, list, $1, $2, false)) { > struct perf_pmu *pmu = NULL; > int ok = 0; > > @@ -245,7 +245,7 @@ PE_NAME opt_event_config > if (!strncmp($1, name, strlen($1)) || !fnmatch($1, name, 0)) { > if (parse_events_copy_term_list(orig_terms, &terms)) > YYABORT; > - if (!parse_events_add_pmu(_parse_state, list, pmu->name, terms)) > + if (!parse_events_add_pmu(_parse_state, list, pmu->name, terms, true)) > ok++; > parse_events_terms__delete(terms); > } > -- > 2.7.4 > ^ permalink raw reply [flat|nested] 8+ messages in thread
* [RFC 3/3] perf pmu: Restore auto-merging of PMU events created by prefix match 2018-02-28 9:40 ` Jiri Olsa @ 2018-02-28 12:45 ` Arnaldo Carvalho de Melo 2018-02-28 13:50 ` Agustin Vega-Frias 0 siblings, 1 reply; 8+ messages in thread From: Arnaldo Carvalho de Melo @ 2018-02-28 12:45 UTC (permalink / raw) To: linux-arm-kernel Em Wed, Feb 28, 2018 at 10:40:38AM +0100, Jiri Olsa escreveu: > On Tue, Feb 27, 2018 at 05:34:08PM -0500, Agustin Vega-Frias wrote: > > This was disabled when auto-merging of non-alias events was disabled in > > commit 63ce844 (perf stat: Only auto-merge events that are PMU aliases). > > this changes the output, right? please provide before/after output Yes, please show how it was and how it became, also please update the documentation, as pointed out by Andi. - Arnaldo > thanks, > jirka > > > > > Signed-off-by: Agustin Vega-Frias <agustinv@codeaurora.org> > > --- > > tools/perf/util/parse-events.c | 13 +++---------- > > tools/perf/util/parse-events.h | 2 +- > > tools/perf/util/parse-events.y | 4 ++-- > > 3 files changed, 6 insertions(+), 13 deletions(-) > > > > diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c > > index bafc91e..4e80ca3 100644 > > --- a/tools/perf/util/parse-events.c > > +++ b/tools/perf/util/parse-events.c > > @@ -1217,7 +1217,7 @@ int parse_events_add_numeric(struct parse_events_state *parse_state, > > get_config_name(head_config), &config_terms); > > } > > > > -static int __parse_events_add_pmu(struct parse_events_state *parse_state, > > +int parse_events_add_pmu(struct parse_events_state *parse_state, > > struct list_head *list, char *name, > > struct list_head *head_config, bool auto_merge_stats) > > { > > @@ -1287,13 +1287,6 @@ static int __parse_events_add_pmu(struct parse_events_state *parse_state, > > return evsel ? 0 : -ENOMEM; > > } > > > > -int parse_events_add_pmu(struct parse_events_state *parse_state, > > - struct list_head *list, char *name, > > - struct list_head *head_config) > > -{ > > - return __parse_events_add_pmu(parse_state, list, name, head_config, false); > > -} > > - > > int parse_events_multi_pmu_add(struct parse_events_state *parse_state, > > char *str, struct list_head **listp) > > { > > @@ -1323,8 +1316,8 @@ int parse_events_multi_pmu_add(struct parse_events_state *parse_state, > > return -1; > > list_add_tail(&term->list, head); > > > > - if (!__parse_events_add_pmu(parse_state, list, > > - pmu->name, head, true)) { > > + if (!parse_events_add_pmu(parse_state, list, > > + pmu->name, head, true)) { > > pr_debug("%s -> %s/%s/\n", str, > > pmu->name, alias->str); > > ok++; > > diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h > > index 88108cd..5015cfd 100644 > > --- a/tools/perf/util/parse-events.h > > +++ b/tools/perf/util/parse-events.h > > @@ -167,7 +167,7 @@ int parse_events_add_breakpoint(struct list_head *list, int *idx, > > void *ptr, char *type, u64 len); > > int parse_events_add_pmu(struct parse_events_state *parse_state, > > struct list_head *list, char *name, > > - struct list_head *head_config); > > + struct list_head *head_config, bool auto_merge_stats); > > > > int parse_events_multi_pmu_add(struct parse_events_state *parse_state, > > char *str, > > diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y > > index c528469..b51278f 100644 > > --- a/tools/perf/util/parse-events.y > > +++ b/tools/perf/util/parse-events.y > > @@ -232,7 +232,7 @@ PE_NAME opt_event_config > > YYABORT; > > > > ALLOC_LIST(list); > > - if (parse_events_add_pmu(_parse_state, list, $1, $2)) { > > + if (parse_events_add_pmu(_parse_state, list, $1, $2, false)) { > > struct perf_pmu *pmu = NULL; > > int ok = 0; > > > > @@ -245,7 +245,7 @@ PE_NAME opt_event_config > > if (!strncmp($1, name, strlen($1)) || !fnmatch($1, name, 0)) { > > if (parse_events_copy_term_list(orig_terms, &terms)) > > YYABORT; > > - if (!parse_events_add_pmu(_parse_state, list, pmu->name, terms)) > > + if (!parse_events_add_pmu(_parse_state, list, pmu->name, terms, true)) > > ok++; > > parse_events_terms__delete(terms); > > } > > -- > > 2.7.4 > > ^ permalink raw reply [flat|nested] 8+ messages in thread
* [RFC 3/3] perf pmu: Restore auto-merging of PMU events created by prefix match 2018-02-28 12:45 ` Arnaldo Carvalho de Melo @ 2018-02-28 13:50 ` Agustin Vega-Frias 0 siblings, 0 replies; 8+ messages in thread From: Agustin Vega-Frias @ 2018-02-28 13:50 UTC (permalink / raw) To: linux-arm-kernel On 2018-02-28 07:45, Arnaldo Carvalho de Melo wrote: > Em Wed, Feb 28, 2018 at 10:40:38AM +0100, Jiri Olsa escreveu: >> On Tue, Feb 27, 2018 at 05:34:08PM -0500, Agustin Vega-Frias wrote: >> > This was disabled when auto-merging of non-alias events was disabled in >> > commit 63ce844 (perf stat: Only auto-merge events that are PMU aliases). >> >> this changes the output, right? please provide before/after output > > Yes, please show how it was and how it became, also please update the > documentation, as pointed out by Andi. Thanks all for the feedback, I'll make the updates requested and submit a follow up. Agust?n > > - Arnaldo > >> thanks, >> jirka >> >> > >> > Signed-off-by: Agustin Vega-Frias <agustinv@codeaurora.org> >> > --- >> > tools/perf/util/parse-events.c | 13 +++---------- >> > tools/perf/util/parse-events.h | 2 +- >> > tools/perf/util/parse-events.y | 4 ++-- >> > 3 files changed, 6 insertions(+), 13 deletions(-) >> > >> > diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c >> > index bafc91e..4e80ca3 100644 >> > --- a/tools/perf/util/parse-events.c >> > +++ b/tools/perf/util/parse-events.c >> > @@ -1217,7 +1217,7 @@ int parse_events_add_numeric(struct parse_events_state *parse_state, >> > get_config_name(head_config), &config_terms); >> > } >> > >> > -static int __parse_events_add_pmu(struct parse_events_state *parse_state, >> > +int parse_events_add_pmu(struct parse_events_state *parse_state, >> > struct list_head *list, char *name, >> > struct list_head *head_config, bool auto_merge_stats) >> > { >> > @@ -1287,13 +1287,6 @@ static int __parse_events_add_pmu(struct parse_events_state *parse_state, >> > return evsel ? 0 : -ENOMEM; >> > } >> > >> > -int parse_events_add_pmu(struct parse_events_state *parse_state, >> > - struct list_head *list, char *name, >> > - struct list_head *head_config) >> > -{ >> > - return __parse_events_add_pmu(parse_state, list, name, head_config, false); >> > -} >> > - >> > int parse_events_multi_pmu_add(struct parse_events_state *parse_state, >> > char *str, struct list_head **listp) >> > { >> > @@ -1323,8 +1316,8 @@ int parse_events_multi_pmu_add(struct parse_events_state *parse_state, >> > return -1; >> > list_add_tail(&term->list, head); >> > >> > - if (!__parse_events_add_pmu(parse_state, list, >> > - pmu->name, head, true)) { >> > + if (!parse_events_add_pmu(parse_state, list, >> > + pmu->name, head, true)) { >> > pr_debug("%s -> %s/%s/\n", str, >> > pmu->name, alias->str); >> > ok++; >> > diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h >> > index 88108cd..5015cfd 100644 >> > --- a/tools/perf/util/parse-events.h >> > +++ b/tools/perf/util/parse-events.h >> > @@ -167,7 +167,7 @@ int parse_events_add_breakpoint(struct list_head *list, int *idx, >> > void *ptr, char *type, u64 len); >> > int parse_events_add_pmu(struct parse_events_state *parse_state, >> > struct list_head *list, char *name, >> > - struct list_head *head_config); >> > + struct list_head *head_config, bool auto_merge_stats); >> > >> > int parse_events_multi_pmu_add(struct parse_events_state *parse_state, >> > char *str, >> > diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y >> > index c528469..b51278f 100644 >> > --- a/tools/perf/util/parse-events.y >> > +++ b/tools/perf/util/parse-events.y >> > @@ -232,7 +232,7 @@ PE_NAME opt_event_config >> > YYABORT; >> > >> > ALLOC_LIST(list); >> > - if (parse_events_add_pmu(_parse_state, list, $1, $2)) { >> > + if (parse_events_add_pmu(_parse_state, list, $1, $2, false)) { >> > struct perf_pmu *pmu = NULL; >> > int ok = 0; >> > >> > @@ -245,7 +245,7 @@ PE_NAME opt_event_config >> > if (!strncmp($1, name, strlen($1)) || !fnmatch($1, name, 0)) { >> > if (parse_events_copy_term_list(orig_terms, &terms)) >> > YYABORT; >> > - if (!parse_events_add_pmu(_parse_state, list, pmu->name, terms)) >> > + if (!parse_events_add_pmu(_parse_state, list, pmu->name, terms, true)) >> > ok++; >> > parse_events_terms__delete(terms); >> > } >> > -- >> > 2.7.4 >> > -- Qualcomm Datacenter Technologies, Inc. on behalf of the Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project. ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-02-28 13:50 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-02-27 22:34 [RFC 0/3] perf stat: improvements for handling of multiple PMUs Agustin Vega-Frias 2018-02-27 22:34 ` [RFC 1/3] perf, tools: Support wildcards on pmu name in dynamic pmu events Agustin Vega-Frias 2018-02-27 23:05 ` Andi Kleen 2018-02-27 22:34 ` [RFC 2/3] perf, tools: Display pmu name when printing unmerged events in stat Agustin Vega-Frias 2018-02-27 22:34 ` [RFC 3/3] perf pmu: Restore auto-merging of PMU events created by prefix match Agustin Vega-Frias 2018-02-28 9:40 ` Jiri Olsa 2018-02-28 12:45 ` Arnaldo Carvalho de Melo 2018-02-28 13:50 ` Agustin Vega-Frias
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).