[PATCH 2/2] perf ftrace: Fix display for range of the first bucket
From: Namhyung Kim
Date: Wed Jan 08 2025 - 16:00:35 EST
When min_latency is not given, it prints 0 - 0. It should be 0 - 1.
Before:
$ sudo ./perf ftrace latency -a -T do_futex sleep 1
# DURATION | COUNT | GRAPH |
0 - 0 us | 321 | ########### |
...
After:
$ sudo ./perf ftrace latency -a -T do_futex sleep 1
# DURATION | COUNT | GRAPH |
0 - 1 us | 699 | ############ |
...
Fixes: b875b6bf608589 ("perf ftrace latency: Introduce --min-latency to narrow down into a latency range")
Cc: Gabriele Monaco <gmonaco@xxxxxxxxxx>
Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
---
tools/perf/builtin-ftrace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
index 90cf2c9915a7e35b..cfd770ec72867d77 100644
--- a/tools/perf/builtin-ftrace.c
+++ b/tools/perf/builtin-ftrace.c
@@ -840,7 +840,7 @@ static void display_histogram(struct perf_ftrace *ftrace, int buckets[])
bar_len = buckets[0] * bar_total / total;
printf(" %4d - %4d %s | %10d | %.*s%*s |\n",
- 0, min_latency, use_nsec ? "ns" : "us",
+ 0, min_latency ?: 1, use_nsec ? "ns" : "us",
buckets[0], bar_len, bar, bar_total - bar_len, "");
for (i = 1; i < NUM_BUCKET - 1; i++) {
--
2.47.1.613.gc27f4b7a9f-goog