perf metrics: Don't scale counts going into metrics
Counts are scaled prior to going into saved_value, reverse the scaling so that metrics don't double scale values. Signed-off-by: Ian Rogers <irogers@google.com> Cc: Ahmad Yasin <ahmad.yasin@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Caleb Biggers <caleb.biggers@intel.com> Cc: Florian Fischer <florian.fischer@muhq.space> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@arm.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: John Garry <john.garry@huawei.com> Cc: Kajol Jain <kjain@linux.ibm.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Kshipra Bopardikar <kshipra.bopardikar@intel.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Miaoqian Lin <linmq006@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Perry Taylor <perry.taylor@intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Samantha Alt <samantha.alt@intel.com> Cc: Stephane Eranian <eranian@google.com> Cc: Thomas Richter <tmricht@linux.ibm.com> Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com> Link: https://lore.kernel.org/r/20221004021612.325521-5-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
715b824f4a
commit
8cff7490fc
@ -865,11 +865,16 @@ static int prepare_metric(struct evsel **metric_events,
|
||||
if (!v)
|
||||
break;
|
||||
stats = &v->stats;
|
||||
scale = 1.0;
|
||||
/*
|
||||
* If an event was scaled during stat gathering, reverse
|
||||
* the scale before computing the metric.
|
||||
*/
|
||||
scale = 1.0 / metric_events[i]->scale;
|
||||
|
||||
source_count = evsel__source_count(metric_events[i]);
|
||||
|
||||
if (v->metric_other)
|
||||
metric_total = v->metric_total;
|
||||
metric_total = v->metric_total * scale;
|
||||
}
|
||||
n = strdup(evsel__metric_id(metric_events[i]));
|
||||
if (!n)
|
||||
|
Loading…
Reference in New Issue
Block a user