Last active
April 13, 2016 14:37
-
-
Save ten0s/1d7c426e7d59ef938c74e16eb19f9b0b to your computer and use it in GitHub Desktop.
Quick timed evaluation of erlang function call
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
-define(TIME(Call), | |
(fun() -> | |
{Time, Value} = timer:tc(fun() -> Call end), | |
io:format("Call: ~s took: ~p ms~n", [??Call, Time/1000]), | |
Value | |
end)() | |
). | |
In the code: | |
... | |
TraceMap = ?TIME(parse_trace(Backtrace)), | |
... | |
In the shell: | |
... | |
Call: parse_trace ( Backtrace ) took: 1.296 ms | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment