Created
August 2, 2012 06:11
-
-
Save csw/3234330 to your computer and use it in GitHub Desktop.
DTrace script to measure total I/O time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/sbin/dtrace -s | |
syscall::read:entry | |
/execname == "sambamba"/ | |
{ | |
self->ts = timestamp; | |
self->fd = arg0; | |
} | |
syscall::read:return | |
/self->ts/ | |
{ | |
@time["read", fds[self->fd].fi_pathname] = sum(timestamp - self->ts); | |
self->ts = 0; | |
self->fd = 0; | |
} | |
syscall::write:entry | |
/execname == "sambamba"/ | |
{ | |
self->ts = timestamp; | |
self->fd = arg0; | |
} | |
syscall::write:return | |
/self->ts/ | |
{ | |
@time["write", fds[self->fd].fi_pathname] = sum(timestamp - self->ts); | |
self->ts = 0; | |
self->fd = 0; | |
} | |
syscall::write_nocancel:entry | |
/execname == "sambamba"/ | |
{ | |
self->ts = timestamp; | |
self->fd = arg0; | |
} | |
syscall::write_nocancel:return | |
/self->ts/ | |
{ | |
/* @time["write", fds[self->fd].fi_pathname] = sum(timestamp - self->ts); */ | |
@time["write", "-"] = sum(timestamp - self->ts); | |
self->ts = 0; | |
self->fd = 0; | |
} | |
profile:::tick-1sec | |
{ | |
normalize(@time, 1000000); | |
printa(@time); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment