naptime.bt(8)

πŸ“¦
version 0.27.0 Β· 3 versions
  • 0.27.0 Β· alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 0.14.0 Β· ubuntu jammy
  • 0.20.2 Β· ubuntu noble
, in alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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 in HH:MM:SS format. ⏰
  • 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 🫢🌈