Guest User

Untitled

a guest
Feb 25th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. #!/usr/bin/env stap
  2.  
  3. global bytes_flushed, flush_count, hits, misses, start
  4.  
  5. probe process("/home/evan/code/bitcoin/src/bitcoind").mark("cache__flush_start") {
  6. start = gettimeofday_us()
  7. bytes_flushed += $arg1
  8. flush_count++
  9. printf("> flush %d bytes\n", $arg1)
  10. }
  11.  
  12. probe process("/home/evan/code/bitcoin/src/bitcoind").mark("cache__flush_end") {
  13. t = gettimeofday_us() - start
  14. printf("< flush (%d micros)\n", t)
  15. }
  16.  
  17. probe process("/home/evan/code/bitcoin/src/bitcoind").mark("cache__hit") {
  18. hits++
  19. }
  20.  
  21. probe process("/home/evan/code/bitcoin/src/bitcoind").mark("cache__miss") {
  22. misses++
  23. }
  24.  
  25. probe timer.sec(10) {
  26. if (hits || misses)
  27. printf("hit rate: %d / %d\n", hits, hits + misses)
  28. }
  29.  
  30. probe begin {
  31. printf("monitoring for coin flushes...\n")
  32. }
  33.  
  34. probe end {
  35. printf("total flushes: %d\n", flush_count)
  36. printf("total bytes flushed: %d\n", bytes_flushed)
  37. printf("hit rate: %d / %d\n", hits, misses)
  38. }
Add Comment
Please, Sign In to add comment