aboutsummaryrefslogtreecommitdiffstats
path: root/lib/observer/src
diff options
context:
space:
mode:
Diffstat (limited to 'lib/observer/src')
-rw-r--r--lib/observer/src/crashdump_viewer.erl5
-rw-r--r--lib/observer/src/etop.erl35
-rw-r--r--lib/observer/src/etop_gui.erl9
-rw-r--r--lib/observer/src/observer_tv_table.erl4
4 files changed, 44 insertions, 9 deletions
diff --git a/lib/observer/src/crashdump_viewer.erl b/lib/observer/src/crashdump_viewer.erl
index 3b8d17c7d9..64a8457d16 100644
--- a/lib/observer/src/crashdump_viewer.erl
+++ b/lib/observer/src/crashdump_viewer.erl
@@ -214,6 +214,7 @@ script_start([File]) ->
DefaultBrowser =
case os:type() of
{win32,_} -> iexplore;
+ {unix,darwin} -> open;
_ -> firefox
end,
script_start([File,DefaultBrowser]);
@@ -277,8 +278,8 @@ usage() ->
io:format(
"\nusage: cdv file [ browser ]\n"
"\tThe \'file\' must be an existing erlang crash dump.\n"
- "\tDefault browser is \'iexplore\' (Internet Explorer) on Windows\n"
- "\tor else \'firefox\'.\n",
+ "\tDefault browser is \'iexplore\' (Internet Explorer) on Windows,\n"
+ "\t\'open\' on Mac OS X, or else \'firefox\'.\n",
[]).
diff --git a/lib/observer/src/etop.erl b/lib/observer/src/etop.erl
index 428757e5ce..2610060eae 100644
--- a/lib/observer/src/etop.erl
+++ b/lib/observer/src/etop.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2002-2012. All Rights Reserved.
+%% Copyright Ericsson AB 2002-2013. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -325,13 +325,40 @@ loadinfo(SysI) ->
#etop_info{n_procs = Procs,
run_queue = RQ,
now = Now,
- wall_clock = {_, WC},
- runtime = {_, RT}} = SysI,
- Cpu = round(100*RT/WC),
+ wall_clock = WC,
+ runtime = RT} = SysI,
+ Cpu = calculate_cpu_utilization(WC,RT),
Clock = io_lib:format("~2.2.0w:~2.2.0w:~2.2.0w",
tuple_to_list(element(2,calendar:now_to_datetime(Now)))),
{Cpu,Procs,RQ,Clock}.
+calculate_cpu_utilization({_,WC},{_,RT}) ->
+ %% Old version of observer_backend, using statistics(wall_clock)
+ %% and statistics(runtime)
+ case {WC,RT} of
+ {0,0} ->
+ 0;
+ {0,_} ->
+ 100;
+ _ ->
+ round(100*RT/WC)
+ end;
+calculate_cpu_utilization(_,undefined) ->
+ %% First time collecting - no cpu utilization has been measured
+ %% since scheduler_wall_time flag is not yet on
+ 0;
+calculate_cpu_utilization(_,RTInfo) ->
+ %% New version of observer_backend, using statistics(scheduler_wall_time)
+ Sum = lists:foldl(fun({_,A,T},{AAcc,TAcc}) -> {A+AAcc,T+TAcc} end,
+ {0,0},
+ RTInfo),
+ case Sum of
+ {0,0} ->
+ 0;
+ {Active,Total} ->
+ round(100*Active/Total)
+ end.
+
meminfo(MemI, [Tag|Tags]) ->
[round(get_mem(Tag, MemI)/1024)|meminfo(MemI, Tags)];
meminfo(_MemI, []) -> [].
diff --git a/lib/observer/src/etop_gui.erl b/lib/observer/src/etop_gui.erl
index f5cc0deb38..3971646abc 100644
--- a/lib/observer/src/etop_gui.erl
+++ b/lib/observer/src/etop_gui.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2002-2012. All Rights Reserved.
+%% Copyright Ericsson AB 2002-2013. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -276,7 +276,12 @@ clear_lines(From, To, Grid) ->
end.
formatmfa({M, F, A}) ->
- io_lib:format("~w:~w/~w",[M, F, A]).
+ io_lib:format("~w:~w/~w",[M, F, A]);
+formatmfa(Other) ->
+ %% E.g. when running hipe - the current_function for some
+ %% processes will be 'undefined'
+ io_lib:format("~w",[Other]).
+
makegridlines([#etop_proc_info{pid=Pid,
mem=Mem,
diff --git a/lib/observer/src/observer_tv_table.erl b/lib/observer/src/observer_tv_table.erl
index 5d1ab2e946..83619414ad 100644
--- a/lib/observer/src/observer_tv_table.erl
+++ b/lib/observer/src/observer_tv_table.erl
@@ -784,8 +784,10 @@ format_list(List) ->
make_list([Last]) ->
[format(Last), $]];
+make_list([Head|Tail]) when is_list(Tail) ->
+ [format(Head), $,|make_list(Tail)];
make_list([Head|Tail]) ->
- [format(Head), $,|make_list(Tail)].
+ [format(Head), $|, format(Tail), $]].
map_printable_list([$\n|Cs]) ->
[$\\, $n|map_printable_list(Cs)];