diff options
| author | Namhyung Kim <[email protected]> | 2025-02-27 19:12:21 +0000 |
|---|---|---|
| committer | Namhyung Kim <[email protected]> | 2025-03-13 07:18:10 +0000 |
| commit | 9c3344141866b83e1e339ab2dc2006e03c6e6cf2 (patch) | |
| tree | c4bb5e571a521bd416282aedc89df3e67ae214d6 /tools/perf/util/annotate.c | |
| parent | perf test stat: Additional topdown grouping tests (diff) | |
| download | kernel-9c3344141866b83e1e339ab2dc2006e03c6e6cf2.tar.gz kernel-9c3344141866b83e1e339ab2dc2006e03c6e6cf2.zip | |
perf ftrace: Fix latency stats with BPF
When BPF collects the stats for the latency in usec, it first divides
the time by 1000. But that means it would have 0 if the delta is small
and won't update the total time properly.
Let's keep the stats in nsec always and adjust to usec before printing.
Before:
$ sudo ./perf ftrace latency -ab -T mutex_lock --hide-empty -- sleep 0.1
# DURATION | COUNT | GRAPH |
0 - 1 us | 765 | ############################################# |
1 - 2 us | 10 | |
2 - 4 us | 2 | |
4 - 8 us | 5 | |
# statistics (in usec)
total time: 0 <<<--- (here)
avg time: 0
max time: 6
min time: 0
count: 782
After:
$ sudo ./perf ftrace latency -ab -T mutex_lock --hide-empty -- sleep 0.1
# DURATION | COUNT | GRAPH |
0 - 1 us | 880 | ############################################ |
1 - 2 us | 13 | |
2 - 4 us | 8 | |
4 - 8 us | 3 | |
# statistics (in usec)
total time: 268 <<<--- (here)
avg time: 0
max time: 6
min time: 0
count: 904
Tested-by: Athira Rajeev <[email protected]>
Cc: Gabriele Monaco <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Namhyung Kim <[email protected]>
Diffstat (limited to 'tools/perf/util/annotate.c')
0 files changed, 0 insertions, 0 deletions
