runqlat(8)
π§ runqlat(8) π§
Okay bestie, this is the System Manager's Manual page for runqlat(8), and it's giving main character energy β¨
π NAME π
runqlat - Run queue (scheduler) latency as a histogram. π
π SYNOPSIS π
runqlat [-h] [-T] [-m] [-P] [--pidnss] [-L] [-p PID] [interval] [count]
π¦ DESCRIPTION π¦
Okay so this tool measures how long a task sits waiting on a run queue (or the equivalent scheduler data structure) for its turn on-CPU, and then shows you that wait as a histogram π. This time should be small, but a task might have to wait its turn because the CPU is busy. The higher the CPU load, the longer a task will generally need to wait, so it's lowkey a vibe check for your scheduler π
This tool measures two types of run queue latency, and I'm obsessed with both:
- The time from a task being enqueued on a run queue to its context switch and execution. This traces
ttwu_do_wakeup(),wake_up_new_task()->finish_task_switch()with either raw tracepoints (if supported) or kprobes, and it instruments the run queue latency after a voluntary context switch. πΈ - The time from when a task was involuntarily context switched while still in the runnable state, to when it next executed. This is instrumented from
finish_task_switch()alone. π«Ά
This tool uses in-kernel eBPF maps for storing timestamps and the histogram, which is so efficient π₯. Despite that, the overhead can get significant for some workloads, so see the OVERHEAD section (seriously, read it π).
It works by tracing various kernel scheduler functions using dynamic tracing, which means it will need updating to match any changes to those functions. Not gonna lie, that's a little bit of a commitment π
Since this uses BPF, only the root user can use this tool. No exceptions, bestie π
π REQUIREMENTS π
You'll need CONFIG_BPF and bcc. β¨
π OPTIONS π
-hβ Prints the usage message. Your lifeline when you forget everything π-Tβ Includes timestamps on the output. β°-mβ Outputs the histogram in milliseconds instead of microseconds. π-Pβ Prints a histogram for each PID. π§--pidnssβ Prints a histogram for each PID namespace (short for PID namespaces). Perfect for container analysis π¦-Lβ Prints a histogram for each thread ID. π§΅-p PIDβ Only shows this PID. It's filtered in the kernel for efficiency, so it's giving smart π§- interval β The output interval, in seconds. β±οΈ
- count β The number of outputs you want. π’
β¨ EXAMPLES β¨
Summarize run queue latency as a histogram, no cap, that's the whole move:
# runqlat
Print 1 second summaries, 10 times:
# runqlat 1 10
Print 1 second summaries, using milliseconds as units for the histogram, and include timestamps on the output:
# runqlat -mT 1
Trace PID 186 only, with 1 second summaries:
# runqlat -P 185 1
π FIELDS π
usecsβ The microsecond range π·msecsβ The millisecond range π·countβ How many times a task event fell into this range πdistributionβ An ASCII bar chart to visualize the distribution (countcolumn) π
π OVERHEAD π
Be careful here, babe π This traces scheduler functions, which can get super frequent. eBPF has very low overhead, and this tool uses in-kernel maps for efficiency, but for some workloads the frequency of scheduler events can be high enough that the overhead becomes significant. Measure in a lab environment to quantify the overhead before you use it in the wild π§ͺ
πΈ 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 like a bonus episode π
π OS π
Linux π§
π§ͺ STABILITY π§ͺ
Unstable - in development. Still cooking, so handle with care π³
π AUTHOR π
Brendan Gregg, the legend himself π«‘
π SEE ALSO π
runqlen(8), runqslower(8), pidstat(1) π
Okay that's a wrap, bestie! β¨ This page is from the USER COMMANDS section, dated 2016-02-07, and it's all about runqlat(8) π Go forth and measure those run queues π«Άπ¦
π¦ where this page comes from
- debian bookworm: bpfcc-tools 0.26.0+ds-1 Β· Apache-2.0
- debian trixie: bpfcc-tools 0.31.0+ds-7 Β· Apache-2.0
- ubuntu jammy: bpfcc-tools 0.18.0+ds-2 Β· Apache-2.0
- ubuntu noble: bpfcc-tools 0.29.1+ds-1ubuntu7 Β· Apache-2.0
- ubuntu questing: bpfcc-tools 0.31.0+ds-7ubuntu2 Β· Apache-2.0
- 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 anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms