From 08b773e0b43534495d987dda268cf56661cf5c01 Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Thu, 12 May 2016 15:00:44 +0200 Subject: Change binary debug tuple to size and refc info And cut the line after 80 chars --- lib/observer/src/observer_lib.erl | 19 ++++++++++++------- lib/observer/src/observer_procinfo.erl | 8 ++++++-- 2 files changed, 18 insertions(+), 9 deletions(-) (limited to 'lib/observer/src') diff --git a/lib/observer/src/observer_lib.erl b/lib/observer/src/observer_lib.erl index c6a1c73c83..7c1337025f 100644 --- a/lib/observer/src/observer_lib.erl +++ b/lib/observer/src/observer_lib.erl @@ -128,8 +128,8 @@ display_info(Frame, Info) -> Add = fun(BoxInfo) -> case create_box(Panel, BoxInfo) of {Box, InfoFs} -> - wxSizer:add(Sizer, Box, [{flag, ?wxEXPAND bor ?wxALL}, - {border, 5}]), + wxSizer:add(Sizer, Box, + [{flag, ?wxEXPAND bor ?wxALL}, {border, 5}]), wxSizer:addSpacer(Sizer, 5), InfoFs; undefined -> @@ -453,14 +453,19 @@ create_box(Parent, Data) -> link_entry(Panel,Value); _ -> Value = to_str(Value0), - TCtrl = wxStaticText:new(Panel, ?wxID_ANY,Value), - length(Value) > 50 andalso - wxWindow:setToolTip(TCtrl,wxToolTip:new(Value)), - TCtrl + case length(Value) > 100 of + true -> + Shown = lists:sublist(Value, 80), + TCtrl = wxStaticText:new(Panel, ?wxID_ANY, [Shown,"..."]), + wxWindow:setToolTip(TCtrl,wxToolTip:new(Value)), + TCtrl; + false -> + wxStaticText:new(Panel, ?wxID_ANY, Value) + end end, wxSizer:add(Line, 10, 0), % space of size 10 horisontally wxSizer:add(Line, Field, RightProportion), - wxSizer:add(Box, Line, [{proportion,1},{flag,?wxEXPAND}]), + wxSizer:add(Box, Line, [{proportion,1}]), Field; (undefined) -> undefined diff --git a/lib/observer/src/observer_procinfo.erl b/lib/observer/src/observer_procinfo.erl index cff5fbb474..fe2aa11450 100644 --- a/lib/observer/src/observer_procinfo.erl +++ b/lib/observer/src/observer_procinfo.erl @@ -370,7 +370,7 @@ process_info_fields(Pid) -> {"Priority", priority}, {"Trap Exit", trap_exit}, {"Reductions", reductions}, - {"Binary", binary}, + {"Binary", fun(Data) -> stringify_bins(Data) end}, {"Last Calls", last_calls}, {"Catch Level", catchlevel}, {"Trace", trace}, @@ -437,6 +437,11 @@ filter_monitor_info() -> [Pid || {process, Pid} <- Ms] end. +stringify_bins(Data) -> + Bins = proplists:get_value(binary, Data), + [lists:flatten(io_lib:format("<< ~s, refc ~w>>", [observer_lib:to_str({bytes,Sz}),Refc])) + || {_Ptr, Sz, Refc} <- Bins]. + local_pid_str(Pid) -> %% observer can observe remote nodes %% There is no function to get the local @@ -449,7 +454,6 @@ local_pid_str(Pid) -> global_pid_node_pref(Pid) -> %% Global PID node prefix : X of string:strip(string:sub_word(pid_to_list(Pid),1,$.),left,$<). - io_get_data(Pid) -> Pid ! {self(), get_data_and_close}, -- cgit v1.2.3