aboutsummaryrefslogtreecommitdiffstats
path: root/lib/observer
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2016-05-12 15:50:19 +0200
committerSiri Hansen <[email protected]>2016-05-20 09:40:56 +0200
commit7db703f88a8665bf6fc3266619044da3c882b1e3 (patch)
tree25690c8c564b2d5cb504af93e0dfd2d7402345f6 /lib/observer
parentebd440bfc9eb685606250a82cae352f1ee37dac6 (diff)
downloadotp-7db703f88a8665bf6fc3266619044da3c882b1e3.tar.gz
otp-7db703f88a8665bf6fc3266619044da3c882b1e3.tar.bz2
otp-7db703f88a8665bf6fc3266619044da3c882b1e3.zip
[observer] Automatically add active node
When setting trace flags on 'new_processes' or 'new_ports', the currently active node is now automatically added if no other node is traced.
Diffstat (limited to 'lib/observer')
-rw-r--r--lib/observer/src/observer_trace_wx.erl1
-rw-r--r--lib/observer/src/observer_wx.erl10
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/observer/src/observer_trace_wx.erl b/lib/observer/src/observer_trace_wx.erl
index 7df599c602..af90e2100c 100644
--- a/lib/observer/src/observer_trace_wx.erl
+++ b/lib/observer/src/observer_trace_wx.erl
@@ -774,6 +774,7 @@ do_add_pid_or_port(POpts, Nview, LCtrl, OldPs, Ns0, Check) ->
{Ps, New, _Changed} ->
Ns1 = lists:usort([node(Id) || #titem{id=Id} <- New, Check(Id)]),
Nodes = case ordsets:subtract(Ns1, Ns0) of
+ [] when Ns0==[] -> [observer_wx:get_active_node()];
[] -> Ns0; %% No new Nodes
NewNs -> ordsets:union(NewNs, Ns0)
end,
diff --git a/lib/observer/src/observer_wx.erl b/lib/observer/src/observer_wx.erl
index d896da1291..29778f6d13 100644
--- a/lib/observer/src/observer_wx.erl
+++ b/lib/observer/src/observer_wx.erl
@@ -21,8 +21,8 @@
-behaviour(wx_object).
-export([start/0, stop/0]).
--export([create_menus/2, get_attrib/1, get_tracer/0, set_status/1,
- create_txt_dialog/4, try_rpc/4, return_to_localnode/2]).
+-export([create_menus/2, get_attrib/1, get_tracer/0, get_active_node/0,
+ set_status/1, create_txt_dialog/4, try_rpc/4, return_to_localnode/2]).
-export([init/1, handle_event/2, handle_cast/2, terminate/2, code_change/3,
handle_call/3, handle_info/2, check_page_title/1]).
@@ -90,6 +90,9 @@ set_status(What) ->
get_tracer() ->
wx_object:call(observer, get_tracer).
+get_active_node() ->
+ wx_object:call(observer, get_active_node).
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
init(_Args) ->
@@ -385,6 +388,9 @@ handle_call({get_attrib, Attrib}, _From, State) ->
handle_call(get_tracer, _From, State=#state{trace_panel=TraceP}) ->
{reply, TraceP, State};
+handle_call(get_active_node, _From, State=#state{node=Node}) ->
+ {reply, Node, State};
+
handle_call(stop, _, State = #state{frame = Frame}) ->
wxFrame:destroy(Frame),
{stop, normal, ok, State};