Dtrace

From wikinotes

Watch/Count syscalls that a process makes.

Documentation

official docs http://dtrace.org/guide/preface.html#preface
one liners http://www.brendangregg.com/dtrace.html#OneLiners
examples http://www.brendangregg.com/dtrace.html#Examples

Install

FreeBSD

# dtrace is included in base system
pkg install dtrace-toolkit  # (optional) dtrace scripts

kldload dtraceall

MacOS

Usage

dtrace -l

cd /usr/local/share/dtrace-toolkit
./hotkernel            # watch syscalls of entire system
./procsystime -p $PID  # watch syscalls of specific process