Quick Linux Tip #93:
Question: A command is slow. Which syscalls are eating all its time?
Try: strace -c -w ls -laR /home 2>&1 >/dev/null | tail -20
Info: strace -c summarizes system call execution time. Adding -w measures wall-clock time rather than CPU time, exposing I/O bottlenecks like heavy directory scans or file status checks.
Examples:
- $
strace -c -f ./program# Include child process syscalls - $
strace -c -e trace=network curl https://example.com# Filter specifically for network syscalls - $
strace -c -p 3456# Attach profiler to active PID
Note: The -c flag runs the process to completion before outputting the final summary table. High getdents64 time indicates directory traversal bottlenecks.
Leave a Reply