mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00

Sometimes users also want to see average latency as well as histogram. Display latency statistics like avg, max, min at the end. $ sudo ./perf ftrace latency -ab -T synchronize_rcu -- ... # DURATION | COUNT | GRAPH | 0 - 1 us | 0 | | 1 - 2 us | 0 | | 2 - 4 us | 0 | | 4 - 8 us | 0 | | 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 - 2 ms | 0 | | 2 - 4 ms | 0 | | 4 - 8 ms | 0 | | 8 - 16 ms | 1 | ##### | 16 - 32 ms | 7 | ######################################## | 32 - 64 ms | 0 | | 64 - 128 ms | 0 | | 128 - 256 ms | 0 | | 256 - 512 ms | 0 | | 512 - 1024 ms | 0 | | 1 - ... s | 0 | | # statistics (in usec) total time: 171832 avg time: 21479 max time: 30906 min time: 15869 count: 8 Committer testing: root@number:~# perf ftrace latency -nab --bucket-range 100 --max-latency 512 -T switch_mm_irqs_off sleep 1 # DURATION | COUNT | GRAPH | 0 - 100 ns | 314 | ## | 100 - 200 ns | 1843 | ############# | 200 - 300 ns | 1390 | ########## | 300 - 400 ns | 844 | ###### | 400 - 500 ns | 480 | ### | 500 - 512 ns | 315 | ## | 512 - ... ns | 16 | | # statistics (in nsec) total time: 2448936 avg time: 387 max time: 3285 min time: 82 count: 6328 root@number:~# Reviewed-by: James Clark <james.clark@linaro.org> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@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/20250107224352.1128669-1-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
90 lines
1.9 KiB
C
90 lines
1.9 KiB
C
#ifndef __PERF_FTRACE_H__
|
|
#define __PERF_FTRACE_H__
|
|
|
|
#include <linux/list.h>
|
|
|
|
#include "target.h"
|
|
|
|
struct evlist;
|
|
struct hashamp;
|
|
struct stats;
|
|
|
|
struct perf_ftrace {
|
|
struct evlist *evlist;
|
|
struct target target;
|
|
const char *tracer;
|
|
struct list_head filters;
|
|
struct list_head notrace;
|
|
struct list_head graph_funcs;
|
|
struct list_head nograph_funcs;
|
|
struct hashmap *profile_hash;
|
|
unsigned long percpu_buffer_size;
|
|
bool inherit;
|
|
bool use_nsec;
|
|
unsigned int bucket_range;
|
|
unsigned int min_latency;
|
|
unsigned int max_latency;
|
|
int graph_depth;
|
|
int func_stack_trace;
|
|
int func_irq_info;
|
|
int graph_nosleep_time;
|
|
int graph_noirqs;
|
|
int graph_verbose;
|
|
int graph_thresh;
|
|
int graph_tail;
|
|
};
|
|
|
|
struct filter_entry {
|
|
struct list_head list;
|
|
char name[];
|
|
};
|
|
|
|
#define NUM_BUCKET 22 /* 20 + 2 (for outliers in both direction) */
|
|
|
|
#ifdef HAVE_BPF_SKEL
|
|
|
|
int perf_ftrace__latency_prepare_bpf(struct perf_ftrace *ftrace);
|
|
int perf_ftrace__latency_start_bpf(struct perf_ftrace *ftrace);
|
|
int perf_ftrace__latency_stop_bpf(struct perf_ftrace *ftrace);
|
|
int perf_ftrace__latency_read_bpf(struct perf_ftrace *ftrace,
|
|
int buckets[], struct stats *stats);
|
|
int perf_ftrace__latency_cleanup_bpf(struct perf_ftrace *ftrace);
|
|
|
|
#else /* !HAVE_BPF_SKEL */
|
|
|
|
static inline int
|
|
perf_ftrace__latency_prepare_bpf(struct perf_ftrace *ftrace __maybe_unused)
|
|
{
|
|
return -1;
|
|
}
|
|
|
|
static inline int
|
|
perf_ftrace__latency_start_bpf(struct perf_ftrace *ftrace __maybe_unused)
|
|
{
|
|
return -1;
|
|
}
|
|
|
|
static inline int
|
|
perf_ftrace__latency_stop_bpf(struct perf_ftrace *ftrace __maybe_unused)
|
|
{
|
|
return -1;
|
|
}
|
|
|
|
static inline int
|
|
perf_ftrace__latency_read_bpf(struct perf_ftrace *ftrace __maybe_unused,
|
|
int buckets[] __maybe_unused,
|
|
struct stats *stats __maybe_unused)
|
|
{
|
|
return -1;
|
|
}
|
|
|
|
static inline int
|
|
perf_ftrace__latency_cleanup_bpf(struct perf_ftrace *ftrace __maybe_unused)
|
|
{
|
|
return -1;
|
|
}
|
|
|
|
#endif /* HAVE_BPF_SKEL */
|
|
|
|
#endif /* __PERF_FTRACE_H__ */
|