Quick Linux Tip #24:
Try: strace -c -f ./slow_script.sh
Info: strace -c summarizes system calls by total time spent. -f follows child processes. The summary helps reveal which system calls are consuming the most time.
Examples:
- $ strace -c ls -la /usr
- $ strace -c -f -p 1234 # Profile a running PID
- $ strace -e trace=file ./script # Filter file syscalls
Note: High read/write activity can indicate I/O bottlenecks, while high openat activity can indicate excessive file opening. strace adds overhead, so use it for diagnostics rather than production benchmarking.
Follow @LinuxTeck for more #LinuxTips
Leave a Reply