Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/dtrace -s
- #pragma D option quiet
- BEGIN
- {
- printf("Tracing... Hit Ctrl-c to end ,\n");
- opens = 0;
- bytes["read"] = 0;
- bytes["write"] = 0;
- }
- syscall::open*:entry
- {
- opens++;
- total = 0;
- bytes["read"] = 0;
- bytes["write"] = 0;
- }
- syscall::close:return
- /execname == "iozone" && opens == 1 /
- {
- byte_second_write = ((bytes["write"]/1024) * 1000000000) / total;
- printf(" write %d %7d \n", bytes["read"], total);
- printf(" %d \n", byte_second_write);
- }
- syscall::close:return
- /execname == "iozone" && opens == 2 /
- {
- byte_second_write = ((bytes["write"]/1024) * 1000000000) / total;
- printf(" rewrite %d %7d \n", bytes["write"], total);
- printf(" %d \n", byte_second_write);
- }
- syscall::close:return
- /execname == "iozone" && opens == 3 /
- {
- byte_second_read = ((bytes["read"]/1024) * 1000000000) / total;
- printf("read %d %7d \n", bytes["read"], total);
- printf(" %d \n", byte_second_read);
- }
- syscall::close:return
- /execname == "iozone" && opens == 4 /
- {
- byte_second_read = ((bytes["read"]/1024) * 1000000000) / total;
- printf("reread %d %7d \n", bytes["read"], total);
- printf(" %d \n", byte_second_read);
- opens = 0;
- }
- syscall::*read*:entry,
- syscall::*write*:entry
- /execname == "iozone"/
- {
- time_start_ns[probefunc] = timestamp;
- bytes[probefunc] = bytes[probefunc] + arg2;
- /*
- printf("At %Y file %s by %d bytes\n", walltimestamp, probefunc, arg2);
- @[probefunc] = count();
- */
- }
- syscall::*read*:return,
- syscall::*write*:return
- /execname == "iozone" / {
- total = total + (timestamp - time_start_ns[probefunc]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement