naptime.bt(8)
π naptime.bt(8) π
System Manager's Manual πΈ manual name: naptime.bt
β¨ NAME β¨
okay so naptime.bt is the tool that traces voluntary sleep calls π΄ It runs on bpftrace/eBPF and it is literally iconic for this. π
π SYNOPSIS π
naptime.bt
π¦ DESCRIPTION π¦
okay bestie, this tool traces application sleeps π€ So if your app is being slow and you have no idea why, it could be because someone put deliberate sleeps in the routines, especially in admin scripts. π naptime.bt helps you find those nap times and debug the high latency. It's giving detective energy, fr fr. π
Here's how it works: it traces the nanosleep(2) syscall using the syscall tracepoints. β
π¨ Since this uses BPF, only the root user can use this tool. No cap, you need to be root to get in here. π
π§ REQUIREMENTS π§
You need CONFIG_BPF and bpftrace. β¨
π EXAMPLES π
Trace application sleeps via nanosleep(2):
# naptime.bt
π FIELDS π
TIMEβ a timestamp inHH:MM:SSformat. β°PPIDβ the parent process ID. πͺPCOMMβ the parent process name. π«ΆPIDβ the ID of the process that's sleeping. π΄COMMβ the name of the process that's sleeping. πSECONDSβ how long the sleep was requested to last. β³
πΈ OVERHEAD πΈ
Okay this is the best part: nanosleep(2) calls are expected to be low frequency (<< 100/s), so the overhead of this tool is expected to be negligible. π Basically it won't slow your day down. π₯Ή
π 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 lives in the bpftrace repository:
https://github.com/bpftrace/bpftrace
Also look in the bpftrace distribution for a companion _examples.txt file. It has example usage, output, and commentary for this tool, so it's a must-read. π«Ά
π₯οΈ OS π₯οΈ
Linux π§
π§ͺ STABILITY π§ͺ
Unstable - in development. π§ Use it, love it, but know it's still cooking. π³
π AUTHOR π
Brendan Gregg π
π SEE ALSO π
capable.bt(8) π¦
Signed with love by your favourite Unix nerd π USER COMMANDS manual, dated 2019-07-05, covering naptime.bt(8) β¨ bye bestie π«Άπ
π¦ where this page comes from
- alpine 3.24: bpftrace-tools-doc 0.26.1-r0 Β· Apache-2.0
- arch rolling: bpftrace 0.27.0-2 Β· Apache-2.0
- centos-stream 10: bpftrace 0.26.1-1.el10 Β· Apache-2.0
- centos-stream 9: bpftrace 0.26.1-1.el9 Β· ASL 2.0
- debian trixie: bpftrace 0.23.2-1 Β· Apache-2.0
- fedora 43: bpftrace 0.24.0-1.fc43 Β· Apache-2.0
- fedora 43: bpftrace 0.24.2-1.fc43 Β· Apache-2.0
- fedora 44: bpftrace 0.24.2-3.fc44 Β· Apache-2.0
- nixos 26.05: bpftrace 0.25.1
- nixpkgs unstable: bpftrace 0.27.1
- opensuse-leap 16.0: bpftrace-tools 0.23.5-160000.1.2 Β· Apache-2.0
- ubuntu questing: bpftrace 0.23.5-1ubuntu1 Β· Apache-2.0
- ubuntu resolute: bpftrace 0.25.0-1ubuntu1 Β· Apache-2.0
- ubuntu stonking: bpftrace 0.25.0-1ubuntu2 Β· Apache-2.0
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms