Created
April 9, 2019 23:34
-
-
Save dalehamel/74dac2ec39a97e71ffde3f229000179a to your computer and use it in GitHub Desktop.
probe test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'ruby-static-tracing' | |
DEBUG = ENV['DEBUG'] | |
t = StaticTracing::Tracepoint.new('global', 'hello_nsec', Integer, String) | |
p = StaticTracing::Provider.fetch(t.provider) | |
p.enable | |
l = StaticTracing.nsec | |
while true do | |
i = StaticTracing.nsec | |
puts "iteration: #{i-l} ns" if DEBUG | |
l = i | |
if t.enabled? | |
d = StaticTracing.nsec | |
puts "enabled: #{d-i} ns" if DEBUG | |
t.fire(StaticTracing.nsec, "Hello world") | |
f = StaticTracing.nsec | |
puts "fire: #{f-i} ns" if DEBUG | |
puts StaticTracing.nsec | |
puts "Probe fired!" | |
else | |
puts "Not enabled" | |
end | |
sleep 1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment