diff options
| author | Namhyung Kim <namhyung@kernel.org> | 2025-07-13 22:21:43 -0700 |
|---|---|---|
| committer | Namhyung Kim <namhyung@kernel.org> | 2025-07-14 22:51:58 -0700 |
| commit | 8db1d772484dfa959044dd43dc28482c8c543b74 (patch) | |
| tree | 6998d1f49bc37eec199f85aeed270fb6c3c785d5 /tools/perf/Documentation | |
| parent | b4aff7ed7a4c1360e8b29d545c7bc9e05af1a995 (diff) | |
| download | linux-next-8db1d772484dfa959044dd43dc28482c8c543b74.tar.gz linux-next-8db1d772484dfa959044dd43dc28482c8c543b74.zip | |
perf ftrace latency: Add -e option to measure time between two events
In addition to the function latency, it can measure events latencies.
Some kernel tracepoints are paired and it's menningful to measure how
long it takes between the two events. The latency is tracked for the
same thread.
Currently it only uses BPF to do the work but it can be lifted later.
Instead of having separate a BPF program for each tracepoint, it only
uses generic 'event_begin' and 'event_end' programs to attach to any
(raw) tracepoints.
$ sudo perf ftrace latency -a -b --hide-empty \
-e i915_request_wait_begin,i915_request_wait_end -- sleep 1
# DURATION | COUNT | GRAPH |
256 - 512 us | 4 | ###### |
2 - 4 ms | 2 | ### |
4 - 8 ms | 12 | ################### |
8 - 16 ms | 10 | ################ |
# statistics (in usec)
total time: 194915
avg time: 6961
max time: 12855
min time: 373
count: 28
Reviewed-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20250714052143.342851-1-namhyung@kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/perf/Documentation')
| -rw-r--r-- | tools/perf/Documentation/perf-ftrace.txt | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/perf/Documentation/perf-ftrace.txt b/tools/perf/Documentation/perf-ftrace.txt index b77f58c4d2fd..914457853bcf 100644 --- a/tools/perf/Documentation/perf-ftrace.txt +++ b/tools/perf/Documentation/perf-ftrace.txt @@ -139,6 +139,12 @@ OPTIONS for 'perf ftrace latency' Set the function name to get the histogram. Unlike perf ftrace trace, it only allows single function to calculate the histogram. +-e:: +--events=:: + Set the pair of events to get the histogram. The histogram is calculated + by the time difference between the two events from the same thread. This + requires -b/--use-bpf option. + -b:: --use-bpf:: Use BPF to measure function latency instead of using the ftrace (it |
