runqlat(8)

πŸ“¦ version 0.36.1, in centos-stream 10, centos-stream 9, fedora 43, fedora 44

🧚 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:

  1. 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. 🌸
  2. 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 (count column) πŸ“ˆ

πŸ™ˆ 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