Skip to content

Instantly share code, notes, and snippets.

@cshirley
Created November 23, 2018 14:13
Show Gist options
  • Select an option

  • Save cshirley/b8bc624cb9db7fd650835b95dda9c476 to your computer and use it in GitHub Desktop.

Select an option

Save cshirley/b8bc624cb9db7fd650835b95dda9c476 to your computer and use it in GitHub Desktop.
Tracing
def trace_method(filter)
trace = TracePoint.trace(:call) do |tp|
p [tp.event, Time.now.to_f, "#{tp.path}:#{tp.lineno}", tp.defined_class.name, tp.method_id] if tp.path =~ /#{filter}/i
end
trace.enable
yield
trace.disable
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment