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

Especially while using several buckets, it isn't uncommon to have some of them empty and reading the histogram may be a bit more complex: # perf ftrace latency -a -T mutex_lock --bucket-range 5 --max-latency 200 # DURATION | COUNT | GRAPH | 0 - 5 us | 14816 | ###################################### | 5 - 10 us | 1228 | ### | 10 - 15 us | 438 | # | 15 - 20 us | 106 | | 20 - 25 us | 21 | | 25 - 30 us | 11 | | 30 - 35 us | 1 | | 35 - 40 us | 2 | | 40 - 45 us | 4 | | 45 - 50 us | 0 | | 50 - 55 us | 1 | | 55 - 60 us | 0 | | 60 - 65 us | 1 | | 65 - 70 us | 1 | | 70 - 75 us | 1 | | 75 - 80 us | 2 | | 80 - 85 us | 0 | | 85 - 90 us | 1 | | 90 - 95 us | 0 | | 95 - 100 us | 1 | | 100 - 105 us | 0 | | 105 - 110 us | 0 | | 110 - 115 us | 0 | | 115 - 120 us | 0 | | 120 - 125 us | 1 | | 125 - 130 us | 0 | | 130 - 135 us | 0 | | 135 - 140 us | 1 | | 140 - 145 us | 0 | | 145 - 150 us | 0 | | 150 - 155 us | 0 | | 155 - 160 us | 0 | | 160 - 165 us | 0 | | 165 - 170 us | 0 | | 170 - 175 us | 0 | | 175 - 180 us | 0 | | 180 - 185 us | 0 | | 185 - 190 us | 0 | | 190 - 195 us | 0 | | 195 - 200 us | 0 | | 200 - ... us | 2 | | Allow the optional flag --hide-empty to remove buckets with no element and produce a more compact graph. This feature could be misleading since there is no clear indication for missing buckets, for this reason it's disabled by default. # perf ftrace latency -a -T mutex_lock --bucket-range 5 --max-latency --hide-empty 200 # DURATION | COUNT | GRAPH | 0 - 5 us | 14816 | ###################################### | 5 - 10 us | 1228 | ### | 10 - 15 us | 438 | # | 15 - 20 us | 106 | | 20 - 25 us | 21 | | 25 - 30 us | 11 | | 30 - 35 us | 1 | | 35 - 40 us | 2 | | 40 - 45 us | 4 | | 50 - 55 us | 1 | | 60 - 65 us | 1 | | 65 - 70 us | 1 | | 70 - 75 us | 1 | | 75 - 80 us | 2 | | 85 - 90 us | 1 | | 95 - 100 us | 1 | | 120 - 125 us | 1 | | 135 - 140 us | 1 | | 200 - ... us | 2 | | Signed-off-by: Gabriele Monaco <gmonaco@redhat.com> Link: https://lore.kernel.org/r/20250207080446.77630-2-gmonaco@redhat.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
92 lines
2.0 KiB
C
92 lines
2.0 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;
|
|
unsigned int bucket_num;
|
|
bool hide_empty;
|
|
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__ */
|