Every 5 seconds print top 15 functions in the fbt:zfs::* probes. This will return a large number of probes. Every 60 seconds we increase our conter by one, and after 480 iterations (8 hours) we exit. Setting $1 to a number will control the number of iterations allowed.
#!/bin/bash
name=${0/.sh}
user_custom_limit=$1
var_def_limit='480'
var_limit=${user_custom_limit:-${var_def_limit}}
output_log=/root/$name-$(date +"%Y%m%d").log
exec 1> $output_log
dtrace -qn '
inline int INT_limit = '$var_limit';
BEGIN { cnt = 0; }
fbt:zfs::* {
@[probefunc, probename] = count();
}
tick-5sec {
trunc(@, 15); printa("%s %s %@d\n", @); clear(@);
}
tick-60sec { cnt++ }
tick-60sec / cnt > INT_limit / { exit(0); }' \
| while read -r line; do printf "%s\t%s\n" "$(date -R| awk '{print $1,$2,$3,$4,$5}')" "$line"; done