-
-
Save platinumthinker/874799422e0ac5aef240cbd345999e8f to your computer and use it in GitHub Desktop.
LTTng+erlang:trace for tracing function calls/returns
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
| 1> l(dyntrace). | |
| {module,dyntrace} | |
| 2> erlang:trace_pattern({'_','_','_'}, [{'_', [], [{return_trace}]}], [local]). %% For function_call info | |
| 3> erlang:trace_pattern({'_','_','_'}, [{'_', [], [{exception_trace}]}], [local]). %% For exception info | |
| 4> erlang:trace(all, true, [call,'receive', send, {tracer,dyntrace,[]}]). %% Trace function calls with dyntrace (i.e. LTTng) and messaging | |
| 26 | |
| 5> erlang:now(). %% Or whatever function call you want to trace. See the traces coming in LTTng log. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
erlang:trace_pattern('receive', [{['', '$1', ''],[{'=/=','$1',self()}],[]}], []).
erlang:trace(processes, true, ['receive']).
F = fun(F1) -> receive {trace, _, _, X} -> io:format("
1000000pn", [X]), F1(F1); _ -> F1(F1) after 0 -> ok end end.