diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/et/doc/src/et_selector.xml | 4 | ||||
-rw-r--r-- | lib/et/doc/src/et_tutorial.xmlsrc | 2 | ||||
-rw-r--r-- | lib/et/src/et_collector.erl | 24 | ||||
-rw-r--r-- | lib/et/src/et_gs_viewer.erl | 2 | ||||
-rw-r--r-- | lib/et/src/et_internal.hrl | 3 | ||||
-rw-r--r-- | lib/et/src/et_selector.erl | 2 | ||||
-rw-r--r-- | lib/et/src/et_wx_viewer.erl | 8 |
7 files changed, 30 insertions, 15 deletions
diff --git a/lib/et/doc/src/et_selector.xml b/lib/et/doc/src/et_selector.xml index 3e5b030e7a..dd12166d85 100644 --- a/lib/et/doc/src/et_selector.xml +++ b/lib/et/doc/src/et_selector.xml @@ -44,7 +44,7 @@ <type> <v>RawPattern = detail_level()</v> <v>TracePattern = erlang_trace_pattern_match_spec()</v> - <v>detail_level() = min | max | integer(X) when X =< 0, X >= 100</v> + <v>detail_level() = min | max | integer(X) when X >= 0, X =< 100</v> </type> <desc> @@ -65,7 +65,7 @@ <type> <v>Pattern = detail_level() | empty_match_spec() | erlang_trace_pattern_match_spec()</v> - <v>detail_level() = min | max | integer(X) when X =<0, X >= 100</v> + <v>detail_level() = min | max | integer(X) when X >= 0, X =< 100</v> <v>empty_match_spec() = [] </v> </type> diff --git a/lib/et/doc/src/et_tutorial.xmlsrc b/lib/et/doc/src/et_tutorial.xmlsrc index 5c2a5a97e4..c72234a587 100644 --- a/lib/et/doc/src/et_tutorial.xmlsrc +++ b/lib/et/doc/src/et_tutorial.xmlsrc @@ -56,7 +56,7 @@ <p>The number (in this case 85) is an integer from 1 to 100 that specifies the "detail level" of the message. The higher the number, the more important it is. This provides a crude form of - priority filtering. Avoid using 100.</p> + priority filtering.</p> <p>The <c>from</c>, <c>to</c>, and <c>message</c> parameters are exactly what they sound like. <c>from</c> and <c>to</c> are diff --git a/lib/et/src/et_collector.erl b/lib/et/src/et_collector.erl index 289537541d..a63d15fb4c 100644 --- a/lib/et/src/et_collector.erl +++ b/lib/et/src/et_collector.erl @@ -57,6 +57,9 @@ multicast/2 ]). +%% Internal export +-export([monitor_trace_port/2]). + %% gen_server callbacks -export([init/1,terminate/2, code_change/3, handle_call/3, handle_cast/2, handle_info/2]). @@ -144,7 +147,7 @@ %% %% event_order() = trace_ts | event_ts %% trace_pattern() = detail_level() | dbg_match_spec() -%% detail_level() = min | max | integer(X) when X =< 0, X >= 100 +%% detail_level() = min | max | integer(X) when X >= 0, X =< 100 %% trace_client() = %% {event_file, file_name()} | %% {dbg_trace_type(), dbg_trace_parameters()} @@ -415,7 +418,9 @@ report_event(CollectorPid, DetailLevel, FromTo, Label, Contents) -> report_event(CollectorPid, DetailLevel, FromTo, FromTo, Label, Contents). report_event(CollectorPid, DetailLevel, From, To, Label, Contents) - when is_integer(DetailLevel), DetailLevel >= 0, DetailLevel =< 100 -> + when is_integer(DetailLevel), + DetailLevel >= ?detail_level_min, + DetailLevel =< ?detail_level_max -> TS= erlang:now(), E = #event{detail_level = DetailLevel, trace_ts = TS, @@ -681,6 +686,17 @@ trace_spec_wrapper(EventFun, EndFun, EventInitialAcc) start_trace_port(Parameters) -> dbg:tracer(port, dbg:trace_port(ip, Parameters)). +monitor_trace_port(CollectorPid, Parameters) -> + Res = start_trace_port(Parameters), + spawn(fun() -> + MonitorRef = erlang:monitor(process, CollectorPid), + receive + {'DOWN', MonitorRef, _, _, _} -> + dbg:stop_clear() + end + end), + Res. + %%---------------------------------------------------------------------- %% iterate(Handle, Prev, Limit) -> %% iterate(Handle, Prev, Limit, undefined, Prev) @@ -1033,7 +1049,7 @@ handle_call(clear_table, _From, S) -> handle_call(stop, _From, S) -> do_multicast(S#state.subscribers, close), case S#state.trace_global of - true -> rpc:multicall(S#state.trace_nodes, dbg, stop, []); + true -> rpc:multicall(S#state.trace_nodes, dbg, stop_clear, []); false -> ignore end, {stop, shutdown, ok, S}; @@ -1067,7 +1083,7 @@ handle_info(timeout, S) -> handle_info({nodeup, Node}, S) -> Port = S#state.trace_port, MaxQueue = S#state.trace_max_queue, - case rpc:call(Node, ?MODULE, start_trace_port, [{Port, MaxQueue}]) of + case rpc:call(Node, ?MODULE, monitor_trace_port, [self(), {Port, MaxQueue}]) of {ok, _} -> S2 = listen_on_trace_port(Node, Port, S), noreply(S2); diff --git a/lib/et/src/et_gs_viewer.erl b/lib/et/src/et_gs_viewer.erl index 7235269aff..0af7814d15 100644 --- a/lib/et/src/et_gs_viewer.erl +++ b/lib/et/src/et_gs_viewer.erl @@ -75,8 +75,6 @@ -define(incr_x, 60). -define(initial_y, 15). -define(incr_y, 15). --define(detail_level_min, 0). --define(detail_level_max, 100). %%%---------------------------------------------------------------------- %%% Client side diff --git a/lib/et/src/et_internal.hrl b/lib/et/src/et_internal.hrl index 1feb161ef1..419d35afcd 100644 --- a/lib/et/src/et_internal.hrl +++ b/lib/et/src/et_internal.hrl @@ -20,6 +20,9 @@ %% Purpose: Definition of internal data structures %%---------------------------------------------------------------------- +-define(detail_level_min, 0). +-define(detail_level_max, 100). + -record(filter, {name, function}). -define(DEFAULT_FILTER_NAME, all). diff --git a/lib/et/src/et_selector.erl b/lib/et/src/et_selector.erl index 66f5723bad..f39f21aa70 100644 --- a/lib/et/src/et_selector.erl +++ b/lib/et/src/et_selector.erl @@ -39,7 +39,7 @@ %% RawPattern = detail_level() %% TracePattern = erlang_trace_pattern_match_spec() %% -%% detail_level() = min | max | integer(X) when X =< 0, X >= 100 +%% detail_level() = min | max | integer(X) when X >= 0, X =< 100 %% %% min - minimum level of tracing (ignore calls to trace_me/4,5) %% max - maximum level of tracing (all calls to trace_me/4,5) diff --git a/lib/et/src/et_wx_viewer.erl b/lib/et/src/et_wx_viewer.erl index 1e2677e216..5cd3563aed 100644 --- a/lib/et/src/et_wx_viewer.erl +++ b/lib/et/src/et_wx_viewer.erl @@ -40,8 +40,6 @@ -define(incr_x, 60). -define(initial_y, 15). -define(incr_y, 15). --define(detail_level_min, 0). --define(detail_level_max, 100). -record(state, {parent_pid, % Pid of parent process @@ -175,8 +173,8 @@ parse_opt([H | T], S, CollectorOpt) -> {title, Title} -> parse_opt(T, S#state{title = name_to_string(Title)}, CollectorOpt); {detail_level, Level} when is_integer(Level), - Level >= ?detail_level_min, - Level =< ?detail_level_max -> + Level >= ?detail_level_min, + Level =< ?detail_level_max -> parse_opt(T, S#state{detail_level = Level}, CollectorOpt); {detail_level, max} -> parse_opt(T, S#state{detail_level = ?detail_level_max}, CollectorOpt); @@ -1558,7 +1556,7 @@ collect_event(Event, {S, Incr, Order, Active, FilterFun, #e{pos = PrevPos}, Even {S, Incr, Order, Active, FilterFun, LastE, Events2}. display_event(#e{event = Event} = E, S, DC) - when Event#event.detail_level < S#state.detail_level -> + when Event#event.detail_level =< S#state.detail_level -> {FromRefresh, From} = ensure_actor(Event#event.from, S, DC), {FromName, FromPos, S2} = From, {ToRefresh, To} = ensure_actor(Event#event.to, S2, DC), |