The following example displays the average time spent in the
write()
system call, organized by process
name. This example uses the avg
aggregating
function, specifying the expression to average as the argument.
The example averages the wall clock time spent in the system
call and is saved in a file named
writetime.d
:
syscall::write:entry { self->ts = timestamp; } syscall::write:return /self->ts/ { @time[execname] = avg(timestamp - self->ts); self->ts = 0; }
The following output shows the result of running this command,
waiting a few seconds, and then pressing
Ctrl-C
:
#dtrace -s writetime.d
dtrace: script 'writetime.d' matched 2 probes^C
gnome-session 8260 udisks-part-id 9279 gnome-terminal 9378 mozilla-xremote 10061 abrt-handle-eve 13414 vgdisplay 13459 avahi-daemon 14043 vgscan 14190 uptime 14533 lsof 14903 ip 15075 date 15371 ... ps 91792 sestatus 98374 pstree 102566 sysctl 175427 iptables 192835 udisks-daemon 250405 python 282544 dbus-daemon 491069 lsblk 582138 Xorg 2337328 gconfd-2 17880523 cat 59752284 #