aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/src
diff options
context:
space:
mode:
authorStavros Aronis <[email protected]>2012-03-05 11:39:28 +0100
committerHenrik Nord <[email protected]>2012-05-21 15:31:22 +0200
commit4a1fa04e5f57ad56e35aae8e9ff278bf1133889a (patch)
tree522ccc0093ae7910a03eef7e71b9156f5f9ebb7f /lib/dialyzer/src
parent49ccc5df4f2f64ff19dd5751523c8ba45adaf658 (diff)
downloadotp-4a1fa04e5f57ad56e35aae8e9ff278bf1133889a.tar.gz
otp-4a1fa04e5f57ad56e35aae8e9ff278bf1133889a.tar.bz2
otp-4a1fa04e5f57ad56e35aae8e9ff278bf1133889a.zip
Change --time to --statistics and include more info
Diffstat (limited to 'lib/dialyzer/src')
-rw-r--r--lib/dialyzer/src/dialyzer_cl_parse.erl9
-rw-r--r--lib/dialyzer/src/dialyzer_coordinator.erl7
-rw-r--r--lib/dialyzer/src/dialyzer_timing.erl29
3 files changed, 34 insertions, 11 deletions
diff --git a/lib/dialyzer/src/dialyzer_cl_parse.erl b/lib/dialyzer/src/dialyzer_cl_parse.erl
index 5baba7d11b..05e50c3d6b 100644
--- a/lib/dialyzer/src/dialyzer_cl_parse.erl
+++ b/lib/dialyzer/src/dialyzer_cl_parse.erl
@@ -164,7 +164,7 @@ cl(["--src"|T]) ->
cl(["--no_spec"|T]) ->
put(dialyzer_options_use_contracts, false),
cl(T);
-cl(["--time"|T]) ->
+cl(["--statistics"|T]) ->
put(dialyzer_timing, true),
cl(T);
cl(["-v"|_]) ->
@@ -356,7 +356,7 @@ help_message() ->
[--apps applications] [-o outfile]
[--build_plt] [--add_to_plt] [--remove_from_plt]
[--check_plt] [--no_check_plt] [--plt_info] [--get_warnings]
- [--no_native] [--fullpath] [--time]
+ [--no_native] [--fullpath] [--statistics]
Options:
files_or_dirs (for backwards compatibility also as: -c files_or_dirs)
Use Dialyzer from the command line to detect defects in the
@@ -423,8 +423,9 @@ Options:
Make Dialyzer a bit more quiet.
--verbose
Make Dialyzer a bit more verbose.
- --time
- Print time information
+ --statistics
+ Prints information about the progress of execution (analysis phases,
+ time spent in each and size of the relative input).
--build_plt
The analysis starts from an empty plt and creates a new one from the
files specified with -c and -r. Only works for beam files.
diff --git a/lib/dialyzer/src/dialyzer_coordinator.erl b/lib/dialyzer/src/dialyzer_coordinator.erl
index 490cfb8d49..63b2d8c3f2 100644
--- a/lib/dialyzer/src/dialyzer_coordinator.erl
+++ b/lib/dialyzer/src/dialyzer_coordinator.erl
@@ -105,6 +105,12 @@ spawn_jobs(Mode, Jobs, InitData) when
Count + 1
end,
JobCount = lists:foldl(Fold, 0, Jobs),
+ Unit =
+ case Mode of
+ 'typesig' -> "SCCs";
+ 'dataflow' -> "modules"
+ end,
+ dialyzer_timing:send_size_info(JobCount, Unit),
#state{active = JobCount, result = [], init_data = InitData};
spawn_jobs(Mode, Jobs, InitData) when
Mode =:= 'compile'; Mode =:= 'warnings' ->
@@ -122,6 +128,7 @@ spawn_jobs(Mode, Jobs, InitData) when
InitTickets = 4*CPUs,
{Tickets, Queue, JobCount} =
lists:foldl(Fold, {InitTickets, queue:new(), 0}, Jobs),
+ dialyzer_timing:send_size_info(JobCount, "modules"),
InitResult =
case Mode of
'warnings' -> [];
diff --git a/lib/dialyzer/src/dialyzer_timing.erl b/lib/dialyzer/src/dialyzer_timing.erl
index dc4d522c2f..c2a7b3ecf8 100644
--- a/lib/dialyzer/src/dialyzer_timing.erl
+++ b/lib/dialyzer/src/dialyzer_timing.erl
@@ -26,7 +26,7 @@
-module(dialyzer_timing).
--export([init/1, start_stamp/1, end_stamp/0, stop/0]).
+-export([init/1, start_stamp/1, send_size_info/2, end_stamp/0, stop/0]).
-spec init(boolean()) -> ok.
@@ -43,7 +43,7 @@ loop_init(Active) ->
case Active of
true ->
io:format("\n"),
- loop(now());
+ loop(now(), 0, "");
false -> dummy_loop()
end.
@@ -53,16 +53,25 @@ dummy_loop() ->
_ -> dummy_loop()
end.
-loop(LastNow) ->
+loop(LastNow, Size, Unit) ->
receive
{stamp, Msg, Now} ->
io:format(" ~-10s (+~4.2fs):", [Msg, diff(Now, LastNow)]),
- loop(Now);
+ loop(Now, 0, "");
{stamp, Now} ->
- io:format("~7.2fs\n", [diff(Now, LastNow)]),
- loop(Now);
+ SizeStr =
+ case Size of
+ 0 -> "";
+ _ ->
+ Data = io_lib:format("~p ~s",[Size, Unit]),
+ io_lib:format(" (~12s)",[Data])
+ end,
+ io:format("~7.2fs~s\n", [diff(Now, LastNow), SizeStr]),
+ loop(Now, 0, "");
+ {size, NewSize, NewUnit} ->
+ loop(LastNow, NewSize, NewUnit);
{Pid, stop, Now} ->
- io:format(" ~-10s (+~4.2fs)\n", ["",diff(Now, LastNow)]),
+ io:format(" ~-9s (+~5.2fs)\n", ["",diff(Now, LastNow)]),
Pid ! ok
end.
@@ -78,6 +87,12 @@ end_stamp() ->
?MODULE ! {stamp, now()},
ok.
+-spec send_size_info(integer(), string()) -> ok.
+
+send_size_info(Size, Unit) ->
+ ?MODULE ! {size, Size, Unit},
+ ok.
+
-spec stop() -> ok.
stop() ->