Skip to content

Instantly share code, notes, and snippets.

@mvidner
Created June 27, 2016 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mvidner/6aab7852bf7f77445fb1b934d6420de3 to your computer and use it in GitHub Desktop.
Save mvidner/6aab7852bf7f77445fb1b934d6420de3 to your computer and use it in GitHub Desktop.
# a dead stupid profiler/debugger
# usage: ruby -r .../trace_func_profiler.rb my_program.rb
set_trace_func proc { |event, file, line, id, binding, classname|
unless ["line"].include? event
m = "#{classname}.#{id}"
t = Time.now.strftime("%H:%M:%S.%4N")
printf "%s|%8s %s:%-2d %s\n", t, event, file, line, m
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment