less than 1 minute read

To check what a long-running process is doing on linux, use strace:

brew install strace

sudo strace -p <PID>
# Ctrl+C to stop dump.

sudo strace -c -p <PID>
# Ctrl+C to stop to get summary of count of syscalls.

sudo strace -k -p <PID>
# Add stack traces to each syscall to give a better idea of where in the code the syscalls are being made from.

On a Mac, use dtruss:


sudo dtruss -p <PID>
sudo dtruss -c -p <PID>
sudo dtruss -s -p <PID>

sudo dtruss df -h  # Run and examine the `df -h` command.

Via til.simonwillison.net, SO, and opensource.apple.com.

Tags: , ,

Categories:

Updated:

Leave a comment