aboutsummaryrefslogtreecommitdiffstats
path: root/lib/runtime_tools
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2012-01-31 16:13:23 +0100
committerDan Gudmundsson <[email protected]>2012-02-21 15:06:43 +0100
commit49da7aaaed1f8f998bd3d6f1f029236fab9b3d4b (patch)
treec41e511267723041669486611cb5a2dcf1b3d716 /lib/runtime_tools
parent052a42cd072a2ac823d2c5f2cf5436ec4f391f34 (diff)
downloadotp-49da7aaaed1f8f998bd3d6f1f029236fab9b3d4b.tar.gz
otp-49da7aaaed1f8f998bd3d6f1f029236fab9b3d4b.tar.bz2
otp-49da7aaaed1f8f998bd3d6f1f029236fab9b3d4b.zip
[observer] Move data collector to run_time tools
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
%%