Skip to content

Instantly share code, notes, and snippets.

@fujieda
Created December 14, 2012 03:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fujieda/929e1c236cf872fc7219 to your computer and use it in GitHub Desktop.
Save fujieda/929e1c236cf872fc7219 to your computer and use it in GitHub Desktop.
DTrace script to collect statistics about arc misses
#!/usr/sbin/dtrace -s
#pragma D option quiet
#pragma D option dynvarsize=16m
BEGIN
{
printf("tracing...\n");
}
fbt::fop_*:entry
{
self->func = probefunc;
}
fbt::fop_*:return
{
self->func = 0;
}
sdt:zfs::arc-miss
/self->func != 0/
{
@miss[execname, self->func] = count();
}
sdt:zfs::arc-miss
/self->func == 0/
{
@miss[execname, "others"] = count();
}
sdt:zfs::arc-miss
{
/* Use the aggregation instead of using a global variable
to count the total of misses correctly. */
@miss["misses", ""] = count();
}
sdt:zfs::l2arc-miss
/self->func != 0/
{
@l2miss[execname, self->func] = count();
}
sdt:zfs::l2arc-miss
/self->func == 0/
{
@l2miss[execname, "others"] = count();
}
sdt:zfs::l2arc-miss
{
/* Use the aggregation instead of using a global variable
to count the total of misses correctly. */
@l2miss["misses", ""] = count();
}
profile:::tick-10s
{
tick++;
}
profile:::tick-10s
/tick == 10/
{
printf("arc\n");
printa("%s, %s, %@d\n", @miss);
printf("l2arc\n");
printa("%s, %s, %@d\n", @l2miss);
exit(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment