Skip to content

Instantly share code, notes, and snippets.

@platinumthinker
Forked from bokner/LTTng+erlang:trace
Last active June 21, 2017 08:35
Show Gist options
  • Select an option

  • Save platinumthinker/874799422e0ac5aef240cbd345999e8f to your computer and use it in GitHub Desktop.

Select an option

Save platinumthinker/874799422e0ac5aef240cbd345999e8f to your computer and use it in GitHub Desktop.
LTTng+erlang:trace for tracing function calls/returns
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.
@anton-ryabkov

Copy link
Copy Markdown

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment