aboutsummaryrefslogtreecommitdiffstats
path: root/lib/observer/src/observer_traceoptions_wx.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2016-04-28 14:13:33 +0200
committerSiri Hansen <[email protected]>2016-05-19 15:21:51 +0200
commit7621e4aded2b5e8ad1a04102718c9bce21d4dc4c (patch)
tree464f1e8a0275a051841213200221d798ed36c8f9 /lib/observer/src/observer_traceoptions_wx.erl
parent90989e58d9e7f7c6fc3c4b52e4191d66d8ff2a96 (diff)
downloadotp-7621e4aded2b5e8ad1a04102718c9bce21d4dc4c.tar.gz
otp-7621e4aded2b5e8ad1a04102718c9bce21d4dc4c.tar.bz2
otp-7621e4aded2b5e8ad1a04102718c9bce21d4dc4c.zip
[observer] Add tracing of ports
Diffstat (limited to 'lib/observer/src/observer_traceoptions_wx.erl')
-rw-r--r--lib/observer/src/observer_traceoptions_wx.erl38
1 files changed, 37 insertions, 1 deletions
diff --git a/lib/observer/src/observer_traceoptions_wx.erl b/lib/observer/src/observer_traceoptions_wx.erl
index 8a6d1403a8..e623f90df3 100644
--- a/lib/observer/src/observer_traceoptions_wx.erl
+++ b/lib/observer/src/observer_traceoptions_wx.erl
@@ -22,7 +22,7 @@
-include_lib("wx/include/wx.hrl").
-include("observer_defs.hrl").
--export([process_trace/2, trace_pattern/4, select_nodes/2,
+-export([process_trace/2, port_trace/2, trace_pattern/4, select_nodes/2,
output/2, select_matchspec/4]).
process_trace(Parent, Default) ->
@@ -98,6 +98,42 @@ process_trace(Parent, Default) ->
throw(cancel)
end.
+port_trace(Parent, Default) ->
+ Dialog = wxDialog:new(Parent, ?wxID_ANY, "Port Options",
+ [{style, ?wxDEFAULT_DIALOG_STYLE bor ?wxRESIZE_BORDER}]),
+ Panel = wxPanel:new(Dialog),
+ MainSz = wxBoxSizer:new(?wxVERTICAL),
+ OptsSz = wxStaticBoxSizer:new(?wxVERTICAL, Panel, [{label, "Tracing options"}]),
+
+ SendBox = wxCheckBox:new(Panel, ?wxID_ANY, "Trace send message", []),
+ check_box(SendBox, lists:member(send, Default)),
+ RecBox = wxCheckBox:new(Panel, ?wxID_ANY, "Trace receive message", []),
+ check_box(RecBox, lists:member('receive', Default)),
+ EventBox = wxCheckBox:new(Panel, ?wxID_ANY, "Trace port events", []),
+ check_box(EventBox, lists:member(events, Default)),
+
+ [wxSizer:add(OptsSz, CheckBox, []) || CheckBox <- [SendBox,RecBox,EventBox]],
+ wxSizer:add(OptsSz, 150, -1),
+
+ wxPanel:setSizer(Panel, OptsSz),
+ wxSizer:add(MainSz, Panel, [{flag, ?wxEXPAND}, {proportion,1}]),
+ Buttons = wxDialog:createButtonSizer(Dialog, ?wxOK bor ?wxCANCEL),
+ wxSizer:add(MainSz, Buttons, [{flag, ?wxEXPAND bor ?wxALL}, {border, 5}]),
+ wxWindow:setSizerAndFit(Dialog, MainSz),
+ wxSizer:setSizeHints(MainSz, Dialog),
+
+ case wxDialog:showModal(Dialog) of
+ ?wxID_OK ->
+ All = [{SendBox, send}, {RecBox, 'receive'},
+ {EventBox, events}],
+ Opts = [Id || {Tick, Id} <- All, wxCheckBox:getValue(Tick)],
+ wxDialog:destroy(Dialog),
+ lists:reverse(Opts);
+ ?wxID_CANCEL ->
+ wxDialog:destroy(Dialog),
+ throw(cancel)
+ end.
+
trace_pattern(ParentPid, Parent, Node, MatchSpecs) ->
try
{Module,MFAs,MatchSpec} =