Skip to content

Instantly share code, notes, and snippets.

@szaydel
Last active December 17, 2015 10:09
Show Gist options
  • Save szaydel/5592391 to your computer and use it in GitHub Desktop.
Save szaydel/5592391 to your computer and use it in GitHub Desktop.
#!/bin/bash
user_custom_limit=$1
var_def_limit='480'
var_limit=${user_custom_limit:-${var_def_limit}}
var_slow=100
output_log=/root/arc-lat-above-${var_slow}-$(date +"%Y%m%d").log
exec 1> $output_log
dtrace -qn '
inline int OPT_limit = '$var_limit';
inline int OPT_slow = '$var_slow';
BEGIN {
slow = 0;
cnt = 0;
}
::arc_adjust:entry {
self->ts = timestamp
}
::arc_adjust:return {
slow = 1 ? (timestamp - self->ts)/1000 > OPT_slow : 0;
@ = max((timestamp - self->ts)/1000); self->ts = 0;
}
tick-1sec /slow == 1 / {
printf("%Y ", walltimestamp);
printa("%@d\n", @); clear(@); slow = 0;
}
tick-60sec {
cnt++;
}
tick-60sec / cnt > OPT_limit / {
exit(0);
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment