Created
November 23, 2018 14:13
-
-
Save cshirley/b8bc624cb9db7fd650835b95dda9c476 to your computer and use it in GitHub Desktop.
Tracing
This file contains hidden or 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
| 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