Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2. require 'ruby-static-tracing'
  3.  
  4. DEBUG = ENV['DEBUG']
  5.  
  6. t = StaticTracing::Tracepoint.new('global', 'hello_nsec', Integer, String)
  7.  
  8. p = StaticTracing::Provider.fetch(t.provider)
  9. p.enable
  10. l = StaticTracing.nsec
  11.  
  12. while true do
  13. i = StaticTracing.nsec
  14. puts "iteration: #{i-l} ns" if DEBUG
  15. l = i
  16. if t.enabled?
  17. d = StaticTracing.nsec
  18. puts "enabled: #{d-i} ns" if DEBUG
  19. t.fire(StaticTracing.nsec, "Hello world")
  20. f = StaticTracing.nsec
  21. puts "fire: #{f-i} ns" if DEBUG
  22. puts StaticTracing.nsec
  23. puts "Probe fired!"
  24. else
  25. puts "Not enabled"
  26. end
  27. sleep 1
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement