summaryrefslogtreecommitdiff
path: root/tools/perf/util/event.c
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2025-02-13 12:08:18 +0300
committerNamhyung Kim <namhyung@kernel.org>2025-02-19 01:04:32 +0300
commitee1cffbe24e7dc129c737a5f433b35e2ce0bdd78 (patch)
treee9ab50befcc526f3ed95cb301051a6174c89593e /tools/perf/util/event.c
parent61b6b31c2f51f8757ecc65df8a4f5eeff029a804 (diff)
downloadlinux-ee1cffbe24e7dc129c737a5f433b35e2ce0bdd78.tar.xz
perf report: Add latency output field
Latency output field is similar to overhead, but represents overhead for latency rather than CPU consumption. It's re-scaled from overhead by dividing weight by the current parallelism level at the time of the sample. It effectively models profiling with 1 sample taken per unit of wall-clock time rather than unit of CPU time. Signed-off-by: Dmitry Vyukov <dvyukov@google.com> Reviewed-by: Andi Kleen <ak@linux.intel.com> Link: https://lore.kernel.org/r/b6269518758c2166e6ffdc2f0e24cfdecc8ef9c1.1739437531.git.dvyukov@google.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/perf/util/event.c')
-rw-r--r--tools/perf/util/event.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 6ceed46acd5a..c23b77f8f854 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -771,6 +771,12 @@ int machine__resolve(struct machine *machine, struct addr_location *al,
al->parallelism = max(1, min(machine->parallelism, machine__nr_cpus_avail(machine)));
if (test_bit(al->parallelism, symbol_conf.parallelism_filter))
al->filtered |= (1 << HIST_FILTER__PARALLELISM);
+ /*
+ * Multiply it by some const to avoid precision loss or dealing
+ * with floats. The multiplier does not matter otherwise since
+ * we only print it as percents.
+ */
+ al->latency = sample->period * 1000 / al->parallelism;
if (al->map) {
if (symbol_conf.dso_list &&