linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>, Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Andi Kleen <ak@linux.intel.com>, Ian Rogers <irogers@google.com>,
	Stephane Eranian <eranian@google.com>,
	Song Liu <songliubraving@fb.com>,
	Changbin Du <changbin.du@gmail.com>
Subject: Re: [RFC/PATCHSET 0/5] perf ftrace: Implement function latency histogram (v1)
Date: Tue, 30 Nov 2021 11:37:26 -0300	[thread overview]
Message-ID: <YaY3JqOQ2XE22VId@kernel.org> (raw)
In-Reply-To: <20211129231830.1117781-1-namhyung@kernel.org>

Em Mon, Nov 29, 2021 at 03:18:25PM -0800, Namhyung Kim escreveu:
> Hello,
> 
> I've implemented 'latency' subcommand in the perf ftrace command to
> show a histogram of function latency.
> 
> To handle new subcommands, the existing functionality is moved to
> 'trace' subcommand while preserving backward compatibility of not
> having a subcommand at all (defaults to 'trace').
> 
> The latency subcommand accepts a target (kernel, for now) function
> with -T option and shows a histogram like below:

Humm, wouldn't be interesting to shorten this by having a new 'perf
flat' (function latency) tool, on the same level as 'perf ftrace' and
leave 'perf ftrace' to just being a convenient perf interface to what
ftrace provides?

But all around, nice work, cool new toyz! :-)

- Arnaldo
 
>   $ sudo ./perf ftrace latency -a -T mutex_lock sleep 1
>   #   DURATION     |      COUNT | GRAPH                                          |
>        0 - 1    us |       2686 | ######################                         |
>        1 - 2    us |        976 | ########                                       |
>        2 - 4    us |        879 | #######                                        |
>        4 - 8    us |        481 | ####                                           |
>        8 - 16   us |        445 | ###                                            |
>       16 - 32   us |          1 |                                                |
>       32 - 64   us |          0 |                                                |
>       64 - 128  us |          0 |                                                |
>      128 - 256  us |          0 |                                                |
>      256 - 512  us |          0 |                                                |
>      512 - 1024 us |          0 |                                                |
>        1 - 2    ms |          0 |                                                |
>        2 - 4    ms |          0 |                                                |
>        4 - 8    ms |          0 |                                                |
>        8 - 16   ms |          0 |                                                |
>       16 - 32   ms |          0 |                                                |
>       32 - 64   ms |          0 |                                                |
>       64 - 128  ms |          0 |                                                |
>      128 - 256  ms |          0 |                                                |
>      256 - 512  ms |          0 |                                                |
>      512 - 1024 ms |          0 |                                                |
>        1 - ...   s |          0 |                                                |
>   
> It basically use the function graph tracer to extract the duration of
> the function.  But with -b/--use-bpf option, it can use BPF to save
> the histogram in the kernel.  For the same function, it gets:
> 
>   $ sudo ./perf ftrace latency -a -b -T mutex_lock sleep 1
>   #   DURATION     |      COUNT | GRAPH                                          |
>        0 - 1    us |       4682 | #############################################  |
>        1 - 2    us |         11 |                                                |
>        2 - 4    us |          0 |                                                |
>        4 - 8    us |          0 |                                                |
>        8 - 16   us |          7 |                                                |
>       16 - 32   us |          6 |                                                |
>       32 - 64   us |          0 |                                                |
>       64 - 128  us |          0 |                                                |
>      128 - 256  us |          0 |                                                |
>      256 - 512  us |          0 |                                                |
>      512 - 1024 us |          0 |                                                |
>        1 - 2    ms |          0 |                                                |
>        2 - 4    ms |          0 |                                                |
>        4 - 8    ms |          0 |                                                |
>        8 - 16   ms |          0 |                                                |
>       16 - 32   ms |          0 |                                                |
>       32 - 64   ms |          0 |                                                |
>       64 - 128  ms |          0 |                                                |
>      128 - 256  ms |          0 |                                                |
>      256 - 512  ms |          0 |                                                |
>      512 - 1024 ms |          0 |                                                |
>        1 - ...   s |          0 |                                                |
> 
> 
> You can get the patches at 'perf/ftrace-latency-v1' branch on
> 
>   https://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git
> 
> 
> Thanks,
> Namhyung
> 
> 
> Namhyung Kim (5):
>   perf ftrace: Add 'trace' subcommand
>   perf ftrace: Move out common code from __cmd_ftrace
>   perf ftrace: Add 'latency' subcommand
>   perf ftrace: Add -b/--use-bpf option for latency subcommand
>   perf ftrace: Implement cpu and task filters in BPF
> 
>  tools/perf/Makefile.perf                    |   2 +-
>  tools/perf/builtin-ftrace.c                 | 443 +++++++++++++++++---
>  tools/perf/util/Build                       |   1 +
>  tools/perf/util/bpf_ftrace.c                | 154 +++++++
>  tools/perf/util/bpf_skel/func_latency.bpf.c | 113 +++++
>  tools/perf/util/ftrace.h                    |  81 ++++
>  6 files changed, 724 insertions(+), 70 deletions(-)
>  create mode 100644 tools/perf/util/bpf_ftrace.c
>  create mode 100644 tools/perf/util/bpf_skel/func_latency.bpf.c
>  create mode 100644 tools/perf/util/ftrace.h
> 
> 
> base-commit: 8ab774587903771821b59471cc723bba6d893942
> -- 
> 2.34.0.rc2.393.gf8c9666880-goog

-- 

- Arnaldo

  parent reply	other threads:[~2021-11-30 14:37 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-29 23:18 [RFC/PATCHSET 0/5] perf ftrace: Implement function latency histogram (v1) Namhyung Kim
2021-11-29 23:18 ` [PATCH 1/5] perf ftrace: Add 'trace' subcommand Namhyung Kim
2021-11-29 23:18 ` [PATCH 2/5] perf ftrace: Move out common code from __cmd_ftrace Namhyung Kim
2021-11-29 23:18 ` [PATCH 3/5] perf ftrace: Add 'latency' subcommand Namhyung Kim
2021-11-29 23:18 ` [PATCH 4/5] perf ftrace: Add -b/--use-bpf option for latency subcommand Namhyung Kim
2021-12-06  2:24   ` Athira Rajeev
2021-12-06 17:16     ` Namhyung Kim
2021-12-15 18:15       ` Namhyung Kim
2021-12-15 18:22         ` Namhyung Kim
2021-12-07  1:05   ` Song Liu
2021-12-07 18:00     ` Namhyung Kim
2021-12-13  7:23       ` Namhyung Kim
2021-11-29 23:18 ` [PATCH 5/5] perf ftrace: Implement cpu and task filters in BPF Namhyung Kim
2021-11-30 14:37 ` Arnaldo Carvalho de Melo [this message]
2021-11-30 22:58   ` [RFC/PATCHSET 0/5] perf ftrace: Implement function latency histogram (v1) Namhyung Kim
2021-12-01  0:36     ` Stephane Eranian
2021-12-01 11:59       ` Arnaldo Carvalho de Melo
2021-12-01 17:21         ` Namhyung Kim
2021-12-03 13:43           ` Arnaldo Carvalho de Melo
2021-12-03 18:11             ` Namhyung Kim
2021-12-13 18:24 ` Arnaldo Carvalho de Melo
2021-12-13 19:40   ` Namhyung Kim
2021-12-15 15:30     ` Arnaldo Carvalho de Melo
2021-12-15 15:44       ` Arnaldo Carvalho de Melo
2021-12-15 18:08         ` Namhyung Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YaY3JqOQ2XE22VId@kernel.org \
    --to=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=changbin.du@gmail.com \
    --cc=eranian@google.com \
    --cc=irogers@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=songliubraving@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).