naptime.bt(8)
π€ naptime.bt β from the System Manager's Manual, section 8 π
okay bestie, picture this: it's naptime.bt and it is literally the sleep detective of your system. β¨
πΈ NAME πΈ
naptime.bt β trace voluntary sleep calls. π Uses bpftrace/eBPF, no cap.
π¦ SYNOPSIS π¦
naptime.bt
that's it. that's the whole thing. she takes no arguments and she does not need them. π
β¨ DESCRIPTION β¨
so this tool traces application sleeps, right? like, it's the girl who catches your code taking a lil nap when it should be working. super useful for debugging high latency that might be caused by deliberate sleeps tucked into your application routines β especially admin scripts, because we all know those scripts love a good snooze. π΄
the way it works? it traces the nanosleep(2) syscall using the syscall tracepoints. tracing the syscall, tracing the nap. iconic behavior honestly. π₯
π heads up bestie: since this uses BPF, only the root user can use this tool. root only. no exceptions, no workarounds, that's the vibe.
π§ REQUIREMENTS π§
CONFIG_BPFbpftrace
both of them. together. it's giving power couple. π
π EXAMPLES π
Trace application sleeps via nanosleep(2):
# naptime.bt
that's the whole incantation. run it as root, watch the naps roll in. π
π FIELDS π
okay so when the output comes through, here's what each column is serving you:
TIMEβ a timestamp inHH:MM:SSformat. clock in, bestie. β°PPIDβ parent process ID. the mom, essentially.PCOMMβ parent process name.PIDβ the sleeping process ID. the actual napper. π΄COMMβ the sleeping process name.SECONDSβ the requested duration of the sleep. how long the nap was supposed to last. π
π OVERHEAD π
nanosleep(2) calls are expected to be low frequency (<< 100/s), so the overhead of this tool is expected to be negligible. she's lightweight, she's polite, she does not eat your CPU. we love a low-maintenance icon. β¨
π SOURCE π
this tool originated from the book "BPF Performance Tools", published by Addison Wesley (2019):
http://www.brendangregg.com/bpf-performance-tools-book.html
see the book for more documentation on this tool. π
this version is in the bpftrace repository:
https://github.com/iovisor/bpftrace
also look in the bpftrace distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool. π
π§ OS π§
Linux. obviously. π
β οΈ STABILITY β οΈ
Unstable - in development. so like, she's growing, she's evolving, she's in her development era. treat her with love and maybe don't put her in production-critical vibes without knowing that. π¦
π AUTHOR π
Brendan Gregg π
π«Ά SEE ALSO π«Ά
and that's the whole page, bestie!! π this came out under the USER COMMANDS section of the manual, dated 2019-07-05, and it's page naptime.bt(8). go trace some sleeps, slay, and remember: naps are valid, but latency is not. π€πβ¨
π¦ where this page comes from
- debian bookworm: bpftrace 0.17.0-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms