From 7621e4aded2b5e8ad1a04102718c9bce21d4dc4c Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Thu, 28 Apr 2016 14:13:33 +0200 Subject: [observer] Add tracing of ports --- lib/observer/src/observer_traceoptions_wx.erl | 38 ++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'lib/observer/src/observer_traceoptions_wx.erl') 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} = -- cgit v1.2.3