aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/dialyzer/src/dialyzer.hrl4
-rw-r--r--lib/dialyzer/src/dialyzer_cl_parse.erl4
-rw-r--r--lib/dialyzer/src/dialyzer_timing.erl37
3 files changed, 42 insertions, 3 deletions
diff --git a/lib/dialyzer/src/dialyzer.hrl b/lib/dialyzer/src/dialyzer.hrl
index 70ee408f12..1b999a7b99 100644
--- a/lib/dialyzer/src/dialyzer.hrl
+++ b/lib/dialyzer/src/dialyzer.hrl
@@ -127,14 +127,14 @@
use_contracts = true :: boolean(),
race_detection = false :: boolean(),
behaviours_chk = false :: boolean(),
- timing = false :: boolean(),
+ timing = false :: boolean() | 'debug',
timing_server :: dialyzer_timing:timing_server(),
callgraph_file = "" :: file:filename()}).
-record(options, {files = [] :: [file:filename()],
files_rec = [] :: [file:filename()],
analysis_type = succ_typings :: anal_type1(),
- timing = false :: boolean(),
+ timing = false :: boolean() | 'debug',
defines = [] :: [dial_define()],
from = byte_code :: start_from(),
get_warnings = maybe :: boolean() | 'maybe',
diff --git a/lib/dialyzer/src/dialyzer_cl_parse.erl b/lib/dialyzer/src/dialyzer_cl_parse.erl
index 05e50c3d6b..205b97ccf9 100644
--- a/lib/dialyzer/src/dialyzer_cl_parse.erl
+++ b/lib/dialyzer/src/dialyzer_cl_parse.erl
@@ -167,6 +167,10 @@ cl(["--no_spec"|T]) ->
cl(["--statistics"|T]) ->
put(dialyzer_timing, true),
cl(T);
+cl(["--resources"|T]) ->
+ put(dialyzer_options_report_mode, quiet),
+ put(dialyzer_timing, debug),
+ cl(T);
cl(["-v"|_]) ->
io:format("Dialyzer version "++?VSN++"\n"),
erlang:halt(?RET_NOTHING_SUSPICIOUS);
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;