criticalstat(8)
π criticalstat(8) β the manual page, but make it make sense
okay bestie, sit down, hydrate, because we're about to talk about criticalstat, a tracer from the System Manager's Manual that finds long atomic critical sections in the kernel and reports them. yes it's giving detective energy. yes it's iconic. let's go π΅οΈβοΈβ¨
β¨ NAME β¨
criticalstat β a tracer that finds and reports long atomic critical sections in the kernel. no cap, that's the whole job. π
πΈ SYNOPSIS πΈ
criticalstat [-h] [-p] [-i] [-d DURATION]
π¦ DESCRIPTION π¦
so like, criticalstat traces and reports occurrences of atomic critical sections in the kernel, and it hands you useful stacktraces showing where they came from. origin story, but for latency. π₯
these critical sections pop up all the time: spinlocks, drivers explicitly disabling interrupts or preemption, whatever. IRQ routines in Linux also run with interrupts disabled, so there's a whole buffet of reasons. and bestie, such critical sections are a source of long latency / responsiveness issues for real-time systems. that's the villain of this story, fr fr. π
it works by probing the preempt/irq and cpuidle tracepoints in the kernel. and because it uses BPF, only the root user can use this tool. also your kernel has to be built with certain CONFIG options enabled β see below, i got you. π
β REQUIREMENTS β
enable the following kernel configurations, depending on which kernel version you're on:
CONFIG_DEBUG_PREEMPTCONFIG_PREEMPT_TRACER
for kernel 4.19 and later:
CONFIG_PREEMPTIRQ_TRACEPOINTSCONFIG_TRACE_IRQFLAGSCONFIG_TRACE_PREEMPT_TOGGLE
for kernel 4.15 to 4.18:
CONFIG_PREEMPTIRQ_EVENTSCONFIG_PROVE_LOCKINGCONFIG_DEBUG_PREEMPT
additionally, the following option should be turned off on older kernels:
CONFIG_LOCKDEP
π vibe check: no config, no trace. the kernel has to be built for this. periodt.
π OPTIONS π
-hβ print usage message. the classic "help me bestie" flag. π-pβ find long sections where preemption was disabled on the local CPU.-iβ find long sections where interrupt was disabled on the local CPU.-d DURATIONβ only identify sections that are longer than DURATION, measured in microseconds.
π EXAMPLES π
run with default options: irq disabled for more than 100 uS
# criticalstat
find sections with preemption disabled for more than 100 uS
# criticalstat -p
find sections with IRQ disabled for more than 500 uS
# criticalstat -d 500
find sections with preemption disabled for more than 500 uS
# criticalstat -p -d 500
π OVERHEAD π
ngl, this tool can cause overhead if your application is spending a lot of time in kernel mode. the overhead is variable, but it can be 2-4% of performance degradation. π if the overhead is looking like too much, please pass a higher DURATION to the -d option so it filters more aggressively. main character energy, but make it efficient. π
π§ SOURCE π§
this is from bcc.
https://github.com/iovisor/bcc
also look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool. it's the director's cut, basically. π¬
π OS π
Linux. obviously. π§
π₯ STABILITY π₯
Unstable - in development. she's in her experimental era, we respect it. π«Ά
π AUTHOR π
Joel Fernandes
π SEE ALSO π
Linux kernel's preemptoff and irqoff tracers.
and that's the whole page, bestie!! this little number is from the USER COMMANDS corner of the manual, dated 2018-06-07, and it goes by criticalstat(8). go forth and find those long critical sections. slay. πβ¨ππ¦
π¦ where this page comes from
- ubuntu resolute: bpfcc-tools 0.35.0+ds-1ubuntu2 Β· Apache-2.0
- ubuntu stonking: bpfcc-tools 0.35.0+ds-1ubuntu4 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms