aboutsummaryrefslogtreecommitdiffstats
path: root/lib/runtime_tools
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2012-02-28 12:24:26 +0100
committerDan Gudmundsson <[email protected]>2012-02-28 12:24:26 +0100
commitf06de6450bbbd324a0784780d892fa69908a2126 (patch)
tree991fa019e18655bb251bc27d7d21bf76ec0fab8c /lib/runtime_tools
parent1ac9351c019231b81caa9d27df0339da284247e8 (diff)
parentf413a27b73d1e0ceaf0d31fc9615208f11645108 (diff)
downloadotp-f06de6450bbbd324a0784780d892fa69908a2126.tar.gz
otp-f06de6450bbbd324a0784780d892fa69908a2126.tar.bz2
otp-f06de6450bbbd324a0784780d892fa69908a2126.zip
Merge branch 'dgud/observer/perf-mon/OTP-9891' into maint
Diffstat (limited to 'lib/runtime_tools')
-rw-r--r--lib/runtime_tools/src/observer_backend.erl20
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/runtime_tools/src/observer_backend.erl b/lib/runtime_tools/src/observer_backend.erl
index 2f8ffbcdb6..01e99f3f5e 100644
--- a/lib/runtime_tools/src/observer_backend.erl
+++ b/lib/runtime_tools/src/observer_backend.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2002-2011. All Rights Reserved.
+%% Copyright Ericsson AB 2002-2012. 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
@@ -22,7 +22,7 @@
-export([vsn/0]).
%% observer stuff
--export([sys_info/0, get_table/3, get_table_list/2]).
+-export([sys_info/0, get_table/3, get_table_list/2, fetch_stats/2]).
%% etop stuff
-export([etop_collect/1]).
@@ -198,6 +198,22 @@ get_table_list(mnesia, Opts) ->
end,
lists:foldl(Info, [], mnesia:system_info(tables)).
+fetch_stats(Parent, Time) ->
+ erlang:system_flag(scheduler_wall_time, true),
+ process_flag(trap_exit, true),
+ fetch_stats_loop(Parent, Time),
+ erlang:system_flag(scheduler_wall_time, false).
+
+fetch_stats_loop(Parent, Time) ->
+ receive
+ _Msg -> normal
+ after Time ->
+ _M = Parent ! {stats, 1,
+ erlang:statistics(scheduler_wall_time),
+ erlang:statistics(io),
+ erlang:memory()},
+ fetch_stats(Parent, Time)
+ end.
%%
%% etop backend
%%