]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
perf metric: Don't remove scale from counts
authorIan Rogers <irogers@google.com>
Fri, 9 Feb 2024 20:49:47 +0000 (12:49 -0800)
committerNamhyung Kim <namhyung@kernel.org>
Tue, 13 Feb 2024 21:48:09 +0000 (13:48 -0800)
Counts were switched from the scaled saved value form to the
aggregated count to avoid double accounting. When this happened the
removing of scaling for a count should have been removed, however, it
wasn't and this wasn't observed as it normally doesn't matter because
a counter's scale is 1. A problem was observed with RAPL events that
are scaled.

Fixes: 37cc8ad77cf8 ("perf metric: Directly use counts rather than saved_value")
Signed-off-by: Ian Rogers <irogers@google.com>
Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
Cc: K Prateek Nayak <kprateek.nayak@amd.com>
Cc: James Clark <james.clark@arm.com>
Cc: Kaige Ye <ye@kaige.org>
Cc: John Garry <john.g.garry@oracle.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20240209204947.3873294-5-irogers@google.com
tools/perf/util/stat-shadow.c

index e31426167852ad0d6fe2d94b5f8b84e2a7e7da8a..cf573ff3fa84f2b7b2a38520795b633025bac36f 100644 (file)
@@ -414,12 +414,7 @@ static int prepare_metric(struct evsel **metric_events,
                                val = NAN;
                                source_count = 0;
                        } else {
-                               /*
-                                * If an event was scaled during stat gathering,
-                                * reverse the scale before computing the
-                                * metric.
-                                */
-                               val = aggr->counts.val * (1.0 / metric_events[i]->scale);
+                               val = aggr->counts.val;
                                source_count = evsel__source_count(metric_events[i]);
                        }
                }