Guest User

Untitled

a guest
Jul 20th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. dtrace -qn '
  2. long lastoff[char *];
  3. long nextoff[char *];
  4. long lastdist[char *];
  5. long bytesW;
  6. int first[char *];
  7.  
  8. nfsv4:::op-write-start /!first[args[1]->noi_curpath]/ {
  9. first[args[1]->noi_curpath]++;
  10. lastoff[args[1]->noi_curpath] = args[2]->offset / 1024;
  11. bytesW += args[2]->data_len;
  12. /* We predict next offset, assuming that size of IO is constant, which
  13. * is something we expect if IO is sequential with fix length chunks.
  14. */
  15. nextoff[args[1]->noi_curpath] =
  16. (args[2]->offset / 1024) + (args[2]->data_len / 1024);
  17. }
  18. nfsv4:::op-write-start
  19. / lastoff[args[1]->noi_curpath] != (args[2]->offset / 1024) / {
  20. this->p = args[1]->noi_curpath;
  21. this->cur = args[2]->offset / 1024;
  22. this->iosz = args[2]->data_len / 1024;
  23. bytesW += args[2]->data_len;
  24.  
  25. @qoff[this->iosz] = quantize(lastoff[this->p]);
  26. this->dist = this->cur > lastoff[this->p] ?
  27. this->cur - lastoff[this->p] :
  28. lastoff[this->p] - this->cur;
  29.  
  30. /* If our current offset is greater than previous offset, we are moving
  31. * in the forward direction, and if it is actually lower than previous
  32. * offset, we are moving in reverse direction. Direction changes are
  33. * indicative of random IO.
  34. */
  35. this->is_fw = this->cur > lastoff[this->p] ? 1 : 0;
  36.  
  37. /* nextoff[this->p] was computed previously, by adding size of last
  38. * io to offset at that point. If our current position in the file
  39. * equals our predicted position, stored in nextoff[this->p], we are
  40. * doing fixed size sequential IO.
  41. */
  42. this->is_seq = this->cur == nextoff[this->p];
  43. @seqcnt[this->is_seq ? "SEQUENTIAL" : "RANDOM" ] = count();
  44. @tot[this->is_seq ? "SEQUENTIAL" : "RANDOM" ] = sum(this->iosz);
  45.  
  46. this->dir_label = this->is_fw ? "Forward [ => ]" : "Reverse [ <= ]";
  47. @qdist[this->dir_label] = quantize(this->dist);
  48.  
  49. lastoff[this->p] = (this->cur) - lastoff[this->p];
  50. /* We predict next offset, assuming that size of IO is constant, which
  51. * is something we expect if IO is sequential with fix length chunks.
  52. */
  53. nextoff[this->p] = this->cur + this->iosz;
  54. }
  55. tick-1sec /bytesW/ {
  56. this->b = bytesW;
  57. bytesW = 0;
  58. @avKBps = avg(this->b >> 10);
  59. @minKBps = min(this->b >> 10);
  60. @maxKBps = max(this->b >> 10);
  61. }
  62. END {
  63. printa(" Seek Distance with IO Size: %d(KB) %@d\n", @qoff);
  64. printa(" %s %@d\n", @qdist);
  65. printf("-/- Basic Statistics -/-\n");
  66. printa("Throughput [Avg]: %8@d(KB) | [Min]: %8@d(KB) | [Max]: %8@d(KB)\n",
  67. @avKBps, @minKBps, @maxKBps);
  68. printa("%s IOs count: %@d totaling %@d(KB)\n", @seqcnt, @tot);
  69. }'
Add Comment
Please, Sign In to add comment