Skip to content

Instantly share code, notes, and snippets.

@ten0s
Last active April 13, 2016 14:37
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 ten0s/1d7c426e7d59ef938c74e16eb19f9b0b to your computer and use it in GitHub Desktop.
Save ten0s/1d7c426e7d59ef938c74e16eb19f9b0b to your computer and use it in GitHub Desktop.
Quick timed evaluation of erlang function call
-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