Create a gist now

Instantly share code, notes, and snippets.

@fujieda /arc_miss.d Secret
Created Dec 14, 2012

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