Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. #!/usr/bin/dtrace -s
  2. #pragma D option quiet
  3.  
  4. BEGIN
  5. {
  6. printf("Tracing... Hit Ctrl-c to end ,\n");
  7. opens = 0;
  8. bytes["read"] = 0;
  9. bytes["write"] = 0;
  10. }
  11.  
  12. syscall::open*:entry
  13. {
  14. opens++;
  15. total = 0;
  16. bytes["read"] = 0;
  17. bytes["write"] = 0;
  18. }
  19.  
  20. syscall::close:return
  21. /execname == "iozone" && opens == 1 /
  22. {
  23. byte_second_write = ((bytes["write"]/1024) * 1000000000) / total;
  24. printf(" write %d %7d \n", bytes["read"], total);
  25. printf(" %d \n", byte_second_write);
  26. }
  27.  
  28. syscall::close:return
  29. /execname == "iozone" && opens == 2 /
  30. {
  31. byte_second_write = ((bytes["write"]/1024) * 1000000000) / total;
  32. printf(" rewrite %d %7d \n", bytes["write"], total);
  33. printf(" %d \n", byte_second_write);
  34. }
  35.  
  36. syscall::close:return
  37. /execname == "iozone" && opens == 3 /
  38. {
  39. byte_second_read = ((bytes["read"]/1024) * 1000000000) / total;
  40. printf("read %d %7d \n", bytes["read"], total);
  41. printf(" %d \n", byte_second_read);
  42. }
  43.  
  44. syscall::close:return
  45. /execname == "iozone" && opens == 4 /
  46. {
  47. byte_second_read = ((bytes["read"]/1024) * 1000000000) / total;
  48. printf("reread %d %7d \n", bytes["read"], total);
  49. printf(" %d \n", byte_second_read);
  50. opens = 0;
  51. }
  52.  
  53. syscall::*read*:entry,
  54. syscall::*write*:entry
  55. /execname == "iozone"/
  56. {
  57.  
  58. time_start_ns[probefunc] = timestamp;
  59. bytes[probefunc] = bytes[probefunc] + arg2;
  60. /*
  61. printf("At %Y file %s by %d bytes\n", walltimestamp, probefunc, arg2);
  62.  
  63. @[probefunc] = count();
  64. */
  65. }
  66.  
  67. syscall::*read*:return,
  68. syscall::*write*:return
  69. /execname == "iozone" / {
  70. total = total + (timestamp - time_start_ns[probefunc]);
  71.  
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement