Tracing all calls to handle_info in all processes using recon_trace

Thank you everyone for your kind feedback. I have taken @NobbZ code and fixed it into the following (the original version was missing a map):


traces = 
  :code.all_loaded() 
  |> Stream.map(fn({module, _path}) -> module end) 
  |> Stream.filter(&:erlang.function_exported(&1, :handle_info, 2)) 
  |> Stream.map(&{&1, :handle_info, 2}) 
  |> Enum.map(&:recon_trace.calls(&1, 10))

This allows me to trace the 10 calls to all modules using handle_info.

Now, we can see the following output:

                                         
11:28:07.155854 <0.285.0> memsup:handle_info(time_to_collect, {state,{unix,linux},
       true,
       {2950590464,31605788672},
       {<0.6127.0>,10784136},
       false,60000,30000,0.8,0.05,<0.286.0>,undefined,undefined,[],[]})
                                          
11:28:07.156521 <0.285.0> memsup:handle_info({collected_sys,{2968354816,31605788672}}, {state,{unix,linux},
       true,
       {2950590464,31605788672},
       {<0.6127.0>,10784136},
       false,60000,30000,0.8,0.05,<0.286.0>,
       #Ref<0.960887702.3327131654.82864>,undefined,
       [reg],
       []})
                                          
11:29:07.190019 <0.285.0> memsup:handle_info(time_to_collect, {state,{unix,linux},
       true,
       {2968354816,31605788672},
       {<0.6127.0>,10787544},
       false,60000,30000,0.8,0.05,<0.286.0>,undefined,undefined,[],[]})
                                          
11:29:07.190603 <0.285.0> memsup:handle_info({collected_sys,{2987864064,31605788672}}, {state,{unix,linux},
       true,
       {2968354816,31605788672},
       {<0.6127.0>,10787544},
       false,60000,30000,0.8,0.05,<0.286.0>,
       #Ref<0.960887702.3327131656.11201>,undefined,
       [reg],
       []})

Which confirms this solution is working !

6 Likes