aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/src/dialyzer_timing.erl
diff options
context:
space:
mode:
authorStavros Aronis <[email protected]>2012-03-28 16:11:36 +0200
committerHenrik Nord <[email protected]>2012-05-21 15:31:23 +0200
commit49c657461866f0fe87de2ee7578b46b1b926db10 (patch)
treec006b99e48d48171d5740beb27e0da9f2bf5aa6c /lib/dialyzer/src/dialyzer_timing.erl
parent12b8ce08ece794e677fdd148723fbe0a707bef6f (diff)
downloadotp-49c657461866f0fe87de2ee7578b46b1b926db10.tar.gz
otp-49c657461866f0fe87de2ee7578b46b1b926db10.tar.bz2
otp-49c657461866f0fe87de2ee7578b46b1b926db10.zip
Logfile-like statistics (enabled with --resources)
Diffstat (limited to 'lib/dialyzer/src/dialyzer_timing.erl')
-rw-r--r--lib/dialyzer/src/dialyzer_timing.erl37
1 files changed, 36 insertions, 1 deletions
diff --git a/lib/dialyzer/src/dialyzer_timing.erl b/lib/dialyzer/src/dialyzer_timing.erl
index 15d8795a37..b1a4bdc07c 100644
--- a/lib/dialyzer/src/dialyzer_timing.erl
+++ b/lib/dialyzer/src/dialyzer_timing.erl
@@ -32,13 +32,16 @@
-type timing_server() :: pid() | 'none'.
--spec init(boolean()) -> timing_server().
+-spec init(boolean() | 'debug') -> timing_server().
init(Active) ->
case Active of
true ->
io:format("\n"),
spawn_link(fun() -> loop(now(), 0, "") end);
+ debug ->
+ io:format("\n"),
+ spawn_link(fun() -> debug_loop("") end);
false -> none
end.
@@ -66,6 +69,38 @@ loop(LastNow, Size, Unit) ->
Pid ! ok
end.
+debug_loop(Phase) ->
+ receive
+ Message ->
+ {Runtime,_} = statistics(wall_clock),
+ Procs = erlang:system_info(process_count),
+ ProcMem = erlang:memory(total),
+ Status = io_lib:format("~12w ~6w ~20w", [Runtime, Procs, ProcMem]),
+ case Message of
+ {stamp, Msg, _Now} ->
+ io:format("~s ~s_start\n", [Status, Msg]),
+ debug_loop(Msg);
+ {stamp, _Now} ->
+ io:format("~s ~s_stop\n", [Status, Phase]),
+ debug_loop("");
+ {Pid, stop, _Now} ->
+ Pid ! ok;
+ {Pid, stop} ->
+ Pid ! ok;
+ _ ->
+ debug_loop(Phase)
+ end
+ after
+ 50 ->
+ {Runtime,_} = statistics(wall_clock),
+ Procs = erlang:system_info(process_count),
+ ProcMem = erlang:memory(total),
+ Status = io_lib:format("~12w ~6w ~20w", [Runtime, Procs, ProcMem]),
+ io:format("~s\n", [Status]),
+ debug_loop(Phase)
+ end.
+
+
-spec start_stamp(timing_server(), string()) -> ok.
start_stamp(none, _) -> ok;