Created
February 19, 2016 11:04
-
-
Save jaseemabid/97f7a1770067736b5042 to your computer and use it in GitHub Desktop.
Run the MFA, but log the time taken for it as well.
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
%% @doc Run the MFA, but log the time taken for it as well. | |
prof(M, F, A) -> | |
Note = atom_to_list(M) ++ ":" ++ atom_to_list(F), | |
prof(Note, M, F, A). | |
prof(Note, M, F, A) -> | |
S = os:timestamp(), | |
Result = apply(M, F, A), | |
E = os:timestamp(), | |
Diff = timer:now_diff(E, S)/1.0e6, | |
lager:notice("[Perf] ~p ~ps", [Note, Diff]), | |
Result. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment