* [PATCH 1/1 perf-tools-next] perf ftrace latency: Fix unit on histogram first entry when using --use-nsec
@ 2024-10-29 19:29 Arnaldo Carvalho de Melo
2024-10-31 17:12 ` Namhyung Kim
0 siblings, 1 reply; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-10-29 19:29 UTC (permalink / raw)
To: Namhyung Kim
Cc: Gabriele Monaco, Adrian Hunter, Ian Rogers, Jiri Olsa, Kan Liang,
Linux Kernel Mailing List, linux-perf-users
The use_nsec arg wasn't being taken into account when printing the first
histogram entry, fix it:
root@number:~# perf ftrace latency --use-nsec -T switch_mm_irqs_off -a sleep 2
# DURATION | COUNT | GRAPH |
0 - 1 us | 0 | |
1 - 2 ns | 0 | |
2 - 4 ns | 0 | |
4 - 8 ns | 0 | |
8 - 16 ns | 0 | |
16 - 32 ns | 0 | |
32 - 64 ns | 125 | |
64 - 128 ns | 335 | |
128 - 256 ns | 2155 | #### |
256 - 512 ns | 9996 | ################### |
512 - 1024 ns | 4958 | ######### |
1 - 2 us | 4636 | ######### |
2 - 4 us | 1053 | ## |
4 - 8 us | 15 | |
8 - 16 us | 1 | |
16 - 32 us | 0 | |
32 - 64 us | 0 | |
64 - 128 us | 0 | |
128 - 256 us | 0 | |
256 - 512 us | 0 | |
512 - 1024 us | 0 | |
1 - ... ms | 0 | |
root@number:~#
After:
root@number:~# perf ftrace latency --use-nsec -T switch_mm_irqs_off -a sleep 2
# DURATION | COUNT | GRAPH |
0 - 1 ns | 0 | |
1 - 2 ns | 0 | |
2 - 4 ns | 0 | |
4 - 8 ns | 0 | |
8 - 16 ns | 0 | |
16 - 32 ns | 0 | |
32 - 64 ns | 19 | |
64 - 128 ns | 94 | |
128 - 256 ns | 2191 | #### |
256 - 512 ns | 9719 | #################### |
512 - 1024 ns | 5330 | ########### |
1 - 2 us | 4104 | ######## |
2 - 4 us | 807 | # |
4 - 8 us | 9 | |
8 - 16 us | 0 | |
16 - 32 us | 0 | |
32 - 64 us | 0 | |
64 - 128 us | 0 | |
128 - 256 us | 0 | |
256 - 512 us | 0 | |
512 - 1024 us | 0 | |
1 - ... ms | 0 | |
root@number:~#
Fixes: 84005bb6148618cc ("perf ftrace latency: Add -n/--use-nsec option")
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Gabriele Monaco <gmonaco@redhat.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
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 abcdc49b7a987f82..272d3c70810e7dc3 100644
--- a/tools/perf/builtin-ftrace.c
+++ b/tools/perf/builtin-ftrace.c
@@ -815,7 +815,7 @@ static void display_histogram(int buckets[], bool use_nsec)
bar_len = buckets[0] * bar_total / total;
printf(" %4d - %-4d %s | %10d | %.*s%*s |\n",
- 0, 1, "us", buckets[0], bar_len, bar, bar_total - bar_len, "");
+ 0, 1, use_nsec ? "ns" : "us", buckets[0], bar_len, bar, bar_total - bar_len, "");
for (i = 1; i < NUM_BUCKET - 1; i++) {
int start = (1 << (i - 1));
--
2.47.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1 perf-tools-next] perf ftrace latency: Fix unit on histogram first entry when using --use-nsec
2024-10-29 19:29 [PATCH 1/1 perf-tools-next] perf ftrace latency: Fix unit on histogram first entry when using --use-nsec Arnaldo Carvalho de Melo
@ 2024-10-31 17:12 ` Namhyung Kim
0 siblings, 0 replies; 2+ messages in thread
From: Namhyung Kim @ 2024-10-31 17:12 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Gabriele Monaco, Adrian Hunter, Ian Rogers, Jiri Olsa, Kan Liang,
Linux Kernel Mailing List, linux-perf-users
On Tue, 29 Oct 2024 16:29:02 -0300, Arnaldo Carvalho de Melo wrote:
> The use_nsec arg wasn't being taken into account when printing the first
> histogram entry, fix it:
>
> root@number:~# perf ftrace latency --use-nsec -T switch_mm_irqs_off -a sleep 2
> # DURATION | COUNT | GRAPH |
> 0 - 1 us | 0 | |
> 1 - 2 ns | 0 | |
> 2 - 4 ns | 0 | |
> 4 - 8 ns | 0 | |
> 8 - 16 ns | 0 | |
> 16 - 32 ns | 0 | |
> 32 - 64 ns | 125 | |
> 64 - 128 ns | 335 | |
> 128 - 256 ns | 2155 | #### |
> 256 - 512 ns | 9996 | ################### |
> 512 - 1024 ns | 4958 | ######### |
> 1 - 2 us | 4636 | ######### |
> 2 - 4 us | 1053 | ## |
> 4 - 8 us | 15 | |
> 8 - 16 us | 1 | |
> 16 - 32 us | 0 | |
> 32 - 64 us | 0 | |
> 64 - 128 us | 0 | |
> 128 - 256 us | 0 | |
> 256 - 512 us | 0 | |
> 512 - 1024 us | 0 | |
> 1 - ... ms | 0 | |
> root@number:~#
>
> [...]
Applied to perf-tools-next, thanks!
Best regards,
Namhyung
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-10-31 17:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-29 19:29 [PATCH 1/1 perf-tools-next] perf ftrace latency: Fix unit on histogram first entry when using --use-nsec Arnaldo Carvalho de Melo
2024-10-31 17:12 ` Namhyung Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).