Skip to content

Instantly share code, notes, and snippets.

@Knio
Created September 19, 2011 00:35
Show Gist options
  • Save Knio/1225763 to your computer and use it in GitHub Desktop.
Save Knio/1225763 to your computer and use it in GitHub Desktop.
DTrace acceses to ZFS
#!/usr/sbin/dtrace -s
# pragma D option quiet
zfs_write:entry,
zfs_read:entry,
zfs_putpage:entry,
zfs_getpage:entry
{
self->ts = timestamp;
self->filepath = args[0]->v_path;
}
zfs_write:return,
zfs_read:return,
zfs_putpage:return,
zfs_getpage:return
/self->ts && self->filepath/
{
printf("%15s on %-80s took %12d ms\n", probefunc,
stringof(self->filepath), (timestamp - self->ts) / 1000);
@["time"] = quantize((timestamp - self->ts) / 1000);
self->ts = 0;
self->filepath = 0;
}
tick-10sec
{
printa(@);
clear(@);
trunc(@,0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment