]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
perf ftrace: Fix display for range of the first bucket
authorNamhyung Kim <namhyung@kernel.org>
Wed, 8 Jan 2025 21:00:15 +0000 (13:00 -0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 10 Jan 2025 17:45:43 +0000 (14:45 -0300)
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: 08b875b6bf608589 ("perf ftrace latency: Introduce --min-latency to narrow down into a latency range")
Reviewed-by: Gabriele Monaco <gmonaco@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: Gabriele Monaco <gmonaco@redhat.com
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20250108210015.1188531-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-ftrace.c

index 90cf2c9915a7e35b603f5ec56990575ca2d13dc8..cfd770ec72867d775c0e19932166e49f69d6fca0 100644 (file)
@@ -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++) {