* [PATCH] perf metric: Fix metric_leader
@ 2022-01-15 6:28 Ian Rogers
2022-01-15 20:07 ` Arnaldo Carvalho de Melo
2022-01-17 18:04 ` John Garry
0 siblings, 2 replies; 3+ messages in thread
From: Ian Rogers @ 2022-01-15 6:28 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
Andi Kleen, John Garry, linux-perf-users, linux-kernel
Cc: eranian, Ian Rogers
Multiple events may have a metric_leader to aggregate into. This happens
for uncore events where, for example, uncore_imc is expanded into
uncore_imc_0, uncore_imc_1, etc. Such events all have the same metric_id
and should aggregate into the first event. The change introducing
metric_ids had a bug where the metric_id was compared to itself,
creating an always true condition. Correct this by comparing the
event in the metric_evlist and the metric_leader.
Fixes: ec5c5b3d2c21 ("perf metric: Encode and use metric-id as qualifier")
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/util/metricgroup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
index 51c99cb08abf..1f1b78b0388f 100644
--- a/tools/perf/util/metricgroup.c
+++ b/tools/perf/util/metricgroup.c
@@ -314,7 +314,7 @@ static int setup_metric_events(struct hashmap *ids,
*/
metric_id = evsel__metric_id(ev);
evlist__for_each_entry_continue(metric_evlist, ev) {
- if (!strcmp(evsel__metric_id(metric_events[i]), metric_id))
+ if (!strcmp(evsel__metric_id(ev), metric_id))
ev->metric_leader = metric_events[i];
}
}
--
2.34.1.703.g22d0c6ccf7-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perf metric: Fix metric_leader
2022-01-15 6:28 [PATCH] perf metric: Fix metric_leader Ian Rogers
@ 2022-01-15 20:07 ` Arnaldo Carvalho de Melo
2022-01-17 18:04 ` John Garry
1 sibling, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-01-15 20:07 UTC (permalink / raw)
To: Ian Rogers
Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Namhyung Kim, Andi Kleen, John Garry,
linux-perf-users, linux-kernel, eranian
Em Fri, Jan 14, 2022 at 10:28:52PM -0800, Ian Rogers escreveu:
> Multiple events may have a metric_leader to aggregate into. This happens
> for uncore events where, for example, uncore_imc is expanded into
> uncore_imc_0, uncore_imc_1, etc. Such events all have the same metric_id
> and should aggregate into the first event. The change introducing
> metric_ids had a bug where the metric_id was compared to itself,
> creating an always true condition. Correct this by comparing the
> event in the metric_evlist and the metric_leader.
Thanks, applied.
- Arnaldo
> Fixes: ec5c5b3d2c21 ("perf metric: Encode and use metric-id as qualifier")
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
> tools/perf/util/metricgroup.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
> index 51c99cb08abf..1f1b78b0388f 100644
> --- a/tools/perf/util/metricgroup.c
> +++ b/tools/perf/util/metricgroup.c
> @@ -314,7 +314,7 @@ static int setup_metric_events(struct hashmap *ids,
> */
> metric_id = evsel__metric_id(ev);
> evlist__for_each_entry_continue(metric_evlist, ev) {
> - if (!strcmp(evsel__metric_id(metric_events[i]), metric_id))
> + if (!strcmp(evsel__metric_id(ev), metric_id))
> ev->metric_leader = metric_events[i];
> }
> }
> --
> 2.34.1.703.g22d0c6ccf7-goog
--
- Arnaldo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] perf metric: Fix metric_leader
2022-01-15 6:28 [PATCH] perf metric: Fix metric_leader Ian Rogers
2022-01-15 20:07 ` Arnaldo Carvalho de Melo
@ 2022-01-17 18:04 ` John Garry
1 sibling, 0 replies; 3+ messages in thread
From: John Garry @ 2022-01-17 18:04 UTC (permalink / raw)
To: Ian Rogers, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Namhyung Kim, Andi Kleen, linux-perf-users,
linux-kernel
Cc: eranian
On 15/01/2022 06:28, Ian Rogers wrote:
> Multiple events may have a metric_leader to aggregate into. This happens
> for uncore events where, for example, uncore_imc is expanded into
> uncore_imc_0, uncore_imc_1, etc. Such events all have the same metric_id
> and should aggregate into the first event. The change introducing
> metric_ids had a bug where the metric_id was compared to itself,
> creating an always true condition. Correct this by comparing the
> event in the metric_evlist and the metric_leader.
>
> Fixes: ec5c5b3d2c21 ("perf metric: Encode and use metric-id as qualifier")
> Signed-off-by: Ian Rogers<irogers@google.com>
> ---
Looks ok and I quickly tested it:
Reviewed-by: John Garry <john.garry@huawei.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-17 18:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-15 6:28 [PATCH] perf metric: Fix metric_leader Ian Rogers
2022-01-15 20:07 ` Arnaldo Carvalho de Melo
2022-01-17 18:04 ` John Garry
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).