Applications

From DTraceBook

Jump to: navigation, search

This chapter summarizes DTrace for application analysis, including topics not covered in other chapters.

Contents

Sample One-Liners

See the DTrace book for more one-liners.

proc Provider

Trace new processes:
dtrace -n 'proc:::exec-success { trace(execname); }'

Trace new processes (FreeBSD pre-8.0):
dtrace -n 'proc:::exec_success { trace(execname); }'

New threads created, by process:
dtrace -n 'proc:::lwp-create { @[pid, execname] = count(); }'

Successful signal details:
dtrace -n 'proc:::signal-send { printf("%s -%d %d", execname, args[2], args[1]- >pr_pid); }'

pid Provider

Count libc function calls:
dtrace -n 'pid$target:libc::entry { @[probefunc] = count(); }' -p PID

plockstat Provider

Mutex spin counts by user-level stack trace:
dtrace -n 'plockstat$target:::mutex-acquire /arg2/ { @[ustack()] = sum(arg2); }' -p PID

cpc Provider

User-mode instructions by process name and function name:
dtrace -n 'cpc:::PAPI_tot_ins-user-200000 { @[execname, ufunc(arg1)] = count(); }'

User-mode CPU cycles by process name and function name:
dtrace -n 'cpc:::PAPI_tot_cyc-user-200000 { @[execname, ufunc(arg1)] = count(); }'

User-mode level 1 cache misses by process name and function name:
dtrace -n 'cpc:::PAPI_l1_tcm-user-10000 { @[execname, ufunc(arg1)] = count(); }'

User-mode resource stall cycles by process name and function name:
dtrace -n 'cpc:::PAPI_res_stl-user-50000 { @[execname, ufunc(arg1)] = count(); }'

Scripts

Errata

Links

Personal tools