aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHÃ¥kan Mattsson <[email protected]>2010-02-03 14:27:13 +0000
committerErlang/OTP <[email protected]>2010-02-03 16:11:17 +0100
commit639e0b2ac0fb85335511efcf79327d1f4dfacbc3 (patch)
tree1d4dd659ed579372b1f44adf9e1d4b7968f0498a
parent45f6d10e587c509cfcaf9d9f4f81f88903eb4758 (diff)
downloadotp-639e0b2ac0fb85335511efcf79327d1f4dfacbc3.tar.gz
otp-639e0b2ac0fb85335511efcf79327d1f4dfacbc3.tar.bz2
otp-639e0b2ac0fb85335511efcf79327d1f4dfacbc3.zip
OTP-8058 The GUI parts are rewritten to use wxWidgets. Thanks Olle
Mattsson! For the time being it is still possible to use the old GS based version of the tool, but it is deprecated. The wxWidgets based version is started by default. A new tutorial has been added to the documentation. It is based on Jayson Vantuyl's article http://souja.net/2009/04/making-sense-of-erlangs-event-tracer.htm l. The functions et:trace_me/4 and et:trace_me/5 has been introduced in order to replace the deprecated functions et:report_event/4 and et:report_event/5. Hopefully the new names makes it a little more obvious what the intended usage of the functions are. A print function has been added to the GUI, in order to enable printing of sequence charts. More functionality for hiding unwanted events has been added to the GUI. The max_events, hide_unknown and display_mode configuration parameters to et_viewer is not used any more. Now the event cache in the Viewer only contains those events that actually are displayed in the GUI. Some minor bugs has been fixed. Such as a cleaning up trace patterns at termination and displaying events with detail level 100.
-rw-r--r--lib/et/doc/src/et_selector.xml4
-rw-r--r--lib/et/doc/src/et_tutorial.xmlsrc2
-rw-r--r--lib/et/src/et_collector.erl24
-rw-r--r--lib/et/src/et_gs_viewer.erl2
-rw-r--r--lib/et/src/et_internal.hrl3
-rw-r--r--lib/et/src/et_selector.erl2
-rw-r--r--lib/et/src/et_wx_viewer.erl8
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 =&lt; 0, X >= 100</v>
+ <v>detail_level() = min | max | integer(X) when X &gt;= 0, X =&lt; 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 =&lt;0, X >= 100</v>
+ <v>detail_level() = min | max | integer(X) when X &gt;= 0, X =&lt; 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),