szaydel
5/16/2013 - 2:21 PM

arc_lat.sh

#!/bin/bash

user_custom_limit=$1
var_def_limit='480'
var_limit=${user_custom_limit:-${var_def_limit}}
## var_slow=100 ##    // Not needed in this script.
output_log=/root/arc-lat-$(date +"%Y%m%d").log
exec 1> $output_log

dtrace -qn  'inline int OPT_limit = '$var_limit'; BEGIN {cnt=0; } ::arc_adjust:entry { self->ts = timestamp } ::arc_adjust:return {@["Time (us):"] = quantize((timestamp - self->ts)/1000); self->ts = 0; } tick-60sec { cnt++; } tick-60sec / cnt > OPT_limit / {exit(0); } END {printa("%16s %@d\n", @)}'