perf-stat-hist(8)
β¨ perf-stat-hist(8) β¨
okay bestie, welcome to perf-stat-hist, a lil helper from the Linux System Manager's Manual crew π«Ά. it's a histogram summarizer for tracepoint values and it runs on Linux perf_events, and honestly? it's giving "small script, huge brain" π
πΈ NAME πΈ
perf-stat-hist β histogram summary of tracepoint values. Uses Linux perf_events.
π SYNOPSIS π
perf-stat-hist [-h] [-b buckets|-P power] [-m max] tracepoint variable
[seconds]
π DESCRIPTION π
so this is a proof-of-concept, and it's showing off in-kernel histograms built with Linux perf_events (aka the perf command, iykyk), specifically on older kernels where perf_events doesn't have this native capability yet. it's literally the "we have histograms at home" of perf π₯
these histograms show the distribution of variable, which lets you study the details β multiple modes, outliers, all of it. main character data analysis energy β¨
the way it works: it uses multiple counting tracepoints with different filters, one for each histogram bucket. and yes, it's summarized in-kernel, but using that many tracepoints does add additional overhead π. hopefully in the future this functionality will be provided in an efficient way from perf_events itself, at which point this tool can be deleted or rewritten. manifesting π
π¦ REQUIREMENTS π¦
- Linux
perf_events: addlinux-tools-common, runperf, then add any additional packages it asks for. - Also uses
awk. no cap, it's awk-pilled.
π OPTIONS π
-hβ usage message. the "help me bestie" flag π₯Ί-bbuckets β specify a list of bucket points for the histogram as a string (eg,"10 500 1000"). the histogram will include buckets for less-than the minimum, and greater-than-or-equal-to the maximum. if a single value is specified, only two statistics are gathered: for less-than, and for greater-than-or-equal-to. the overhead is relative to the number of buckets, so specifying a single value costs the lowest overhead. economical queen π-Ppower β power for power-of histogram. by default, a power-of-4 histogram is created. this and the-boption are exclusive β they do not share the aux cord π«-mmax β max value for power-of histograms.- tracepoint β tracepoint specification. eg,
syscalls:sys_enter_read. - variable β the tracepoint variable name to summarize. to see what's available,
catthe format file under/sys/kernel/debug/tracing/events/*/*/format. go snoop, bestie π - seconds β number of seconds to trace. if not specified, this runs until Ctrl-C.
π EXAMPLES π
trace read() syscalls until Ctrl-C, and show histogram of requested size:
# perf-stat-hist syscalls:sys_enter_read count
trace read() syscall completions until Ctrl-C, and show histogram of successful returned size:
# perf-stat-hist syscalls:sys_exit_read ret
trace read() return sizes for 10 seconds, showing histogram:
# perf-stat-hist syscalls:sys_exit_read ret 10
trace network transmits until Ctrl-C, and show histogram of packet size:
# perf-stat-hist net:net_dev_xmit len
trace read() return sizes, using a power-of-10 histogram:
perf-stat-hist -P 10 syscalls:sys_exit_read ret
trace read() return sizes, using a power-of-2 histogram, and a max of 1024:
perf-stat-hist -P 2 -m 1024 syscalls:sys_exit_read ret
trace read() return sizes, using the specified bucket points:
perf-stat-hist -b "10 50 100 5000" syscalls:sys_exit_read ret
trace read() return sizes, and bifurcate statistics by the value 10:
perf-stat-hist -b 10 syscalls:sys_exit_read ret
β FIELDS β
- Range β range of the histogram bucket, in units of the variable specified.
- Count β number of occurrences (tracepoint events) of the variable in this range.
- Distribution β ASCII histogram representation of the
Countcolumn. it's giving bar chart but make it terminal π
π OVERHEAD π
while the counts are performed in-kernel, there is one tracepoint used per histogram bucket, so the overheads are higher than usual (relative to the number of buckets) than function counting using perf stat. the lowest overhead is when -b is used to specify one bucket only, bifurcating statistics. so likeβ¦ don't go feral with buckets unless you mean it π«£
π§ SOURCE π§
this is from the perf-tools collection.
https://github.com/brendangregg/perf-tools
also look under the examples directory for a text file containing example usage, output, and commentary for this tool. homework but cute π
π OS π
Linux π§
π STABILITY π
Unstable β in development. she's still growing, be patient π
π AUTHOR π
Brendan Gregg
π SEE ALSO π
okay that's the whole page, bestie β and a lil sign-off to match the footer: this one lives under the USER COMMANDS source section, dated 2014-07-07, filed as page perf-stat-hist(8) πβ¨ no cap, go histogram something. periodt π
π¦ where this page comes from
- nixos 26.05: perf-tools-unstable 2017-12-19
- nixpkgs unstable: perf-tools-unstable 2017-12-19
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms