diff options
Diffstat (limited to 'lib/observer')
-rw-r--r-- | lib/observer/doc/src/crashdump_ug.xml | 4 | ||||
-rw-r--r-- | lib/observer/src/crashdump_viewer.erl | 5 | ||||
-rw-r--r-- | lib/observer/src/etop.erl | 35 | ||||
-rw-r--r-- | lib/observer/src/etop_gui.erl | 9 | ||||
-rw-r--r-- | lib/observer/src/observer_tv_table.erl | 4 | ||||
-rw-r--r-- | lib/observer/test/etop_SUITE.erl | 24 | ||||
-rw-r--r-- | lib/observer/test/ttb_SUITE.erl | 5 | ||||
-rw-r--r-- | lib/observer/test/ttb_helper.erl | 2 |
8 files changed, 67 insertions, 21 deletions
diff --git a/lib/observer/doc/src/crashdump_ug.xml b/lib/observer/doc/src/crashdump_ug.xml index dc65fe5b39..8b60f6ee98 100644 --- a/lib/observer/doc/src/crashdump_ug.xml +++ b/lib/observer/doc/src/crashdump_ug.xml @@ -48,8 +48,8 @@ Information which shows a short summary of the information in the crashdump.</p> - <p>The default browser is Internet Explorer on Windows or else - Firefox. To use another browser, give the browser's start command + <p>The default browser is Internet Explorer on Windows, open on Mac OS X, + or else Firefox. To use another browser, give the browser's start command as the second argument to <c>cdv</c>. If the given browser name is not known to Crashdump Viewer, the browser argument is executed as a command with the start URL as the only argument.</p> 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)]; diff --git a/lib/observer/test/etop_SUITE.erl b/lib/observer/test/etop_SUITE.erl index 06577f82cc..6ce3ea59cf 100644 --- a/lib/observer/test/etop_SUITE.erl +++ b/lib/observer/test/etop_SUITE.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 @@ -21,7 +21,8 @@ %% Test functions -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2,text/1,text_tracing_off/1]). + init_per_group/2,end_per_group/2]). +-export([text/1,text/2,text_tracing_off/1,text_tracing_off/2]). -export([init_per_testcase/2, end_per_testcase/2]). -include_lib("test_server/include/test_server.hrl"). @@ -31,7 +32,10 @@ init_per_testcase(_Case, Config) -> ?line Dog=test_server:timetrap(?default_timeout), [{watchdog, Dog}|Config]. -end_per_testcase(_Case, Config) -> +end_per_testcase(Case, Config) -> + try apply(?MODULE,Case,[cleanup,Config]) + catch error:undef -> ok + end, Dog=?config(watchdog, Config), ?t:timetrap_cancel(Dog), ok. @@ -82,9 +86,12 @@ text() -> ?line timer:sleep(3000), ?line etop:config(sort,msg_q), ?line timer:sleep(3000), - ?line etop:stop(), - ?line ?t:stop_node(Node), ok. +text(cleanup,_Config) -> + etop:stop(), + {ok,Host} = inet:gethostname(), + Node = list_to_atom("node2@"++Host), + ?t:stop_node(Node). text_tracing_off(suite) -> []; @@ -111,7 +118,10 @@ text_tracing_off(Config) when is_list(Config) -> ?line timer:sleep(3000), ?line etop:config(sort,runtime), % this should not crash, but has no effect ?line timer:sleep(3000), - ?line etop:stop(), - ?line ?t:stop_node(Node), ok. +text_tracing_off(cleanup,_Config) -> + etop:stop(), + {ok,Host} = inet:gethostname(), + Node = list_to_atom("node2@"++Host), + ?t:stop_node(Node). diff --git a/lib/observer/test/ttb_SUITE.erl b/lib/observer/test/ttb_SUITE.erl index 695d41b48a..f3fcd9f283 100644 --- a/lib/observer/test/ttb_SUITE.erl +++ b/lib/observer/test/ttb_SUITE.erl @@ -1,7 +1,8 @@ +%% %% %CopyrightBegin% %% %% -%% Copyright Ericsson AB 2002-2010. 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 @@ -57,7 +58,7 @@ init_per_testcase(Case, Config) -> catch error:undef -> ok end, [{watchdog, Dog}|Config]. -end_per_testcase(Case, Config) -> +end_per_testcase(_Case, Config) -> %% try apply(?MODULE,Case,[cleanup,Config]) %% catch error:undef -> ok %% end, diff --git a/lib/observer/test/ttb_helper.erl b/lib/observer/test/ttb_helper.erl index 76b06cd3ce..05f6d73aef 100644 --- a/lib/observer/test/ttb_helper.erl +++ b/lib/observer/test/ttb_helper.erl @@ -70,7 +70,7 @@ msgs(N) -> msgs_ip(N) -> [c(client, put, [test_msg]) || _ <- lists:seq(1, N)], s(server, received, [a,b]), - timer:sleep(200). %% allow trace messages to arrive over tcp/ip + timer:sleep(500). %% allow trace messages to arrive over tcp/ip run() -> ttb({local, "A"}), |