Skip to content

Commit 6d6be5e

Browse files
captain5050namhyung
authored andcommitted
perf metric: Don't remove scale from counts
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: 37cc8ad ("perf metric: Directly use counts rather than saved_value") Signed-off-by: Ian Rogers <[email protected]> Reviewed-by: Kan Liang <[email protected]> Cc: K Prateek Nayak <[email protected]> Cc: James Clark <[email protected]> Cc: Kaige Ye <[email protected]> Cc: John Garry <[email protected]> Signed-off-by: Namhyung Kim <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 2543947 commit 6d6be5e

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

tools/perf/util/stat-shadow.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -414,12 +414,7 @@ static int prepare_metric(struct evsel **metric_events,
414414
val = NAN;
415415
source_count = 0;
416416
} else {
417-
/*
418-
* If an event was scaled during stat gathering,
419-
* reverse the scale before computing the
420-
* metric.
421-
*/
422-
val = aggr->counts.val * (1.0 / metric_events[i]->scale);
417+
val = aggr->counts.val;
423418
source_count = evsel__source_count(metric_events[i]);
424419
}
425420
}

0 commit comments

Comments
 (0)