-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtracer.erl
More file actions
27 lines (25 loc) · 1.12 KB
/
tracer.erl
File metadata and controls
27 lines (25 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
%%=====================================================
%% Abstract
%%
%% This bascially give a way to start tracking on a list
%% of modules as approprite
%%=====================================================
%%======================================================
%% Tag the file
%%======================================================
-module( tracer ).
-compile( export_all ).
-author("Stephen Bailey").
-email("Stephen.Bailey@stackingit.com").
-vsn( "0.0.0.1" ).
-include_lib("stdlib/include/ms_transform.hrl"). %% Here for the tracing
%%=====================================================
%% Starts and outputs tracer methods for modules
%%=====================================================
trace( Modules, Flags ) ->
% starts the tracer
dbg:tracer(),
% module, function (or '_' for everything). We're not really sure about dbg:fun2ms - some sort of black magic to format the output.
[ dbg:tpl( Module , '_' , '_', dbg:fun2ms( fun(_)-> return_trace() end ) ) || Module <- Modules ],
% this registers what we're interested in, c = "calls". s = "send", r = "receive", m = "send/receive"
dbg:p(all, Flags ).