aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-02-27 10:23:52 +0100
committerBjörn Gustavsson <[email protected]>2015-02-27 10:23:52 +0100
commit80e4d9cfe43c46a3206cc169cbe2c8fb17821f25 (patch)
tree6ec40144574ee6f2ea08e17ba5220892ed4f5014 /lib
parent9e05389d2b3733d0480d50d68d4583a8af59841a (diff)
parent2c1514501519be143b335e594b69636593070a37 (diff)
downloadotp-80e4d9cfe43c46a3206cc169cbe2c8fb17821f25.tar.gz
otp-80e4d9cfe43c46a3206cc169cbe2c8fb17821f25.tar.bz2
otp-80e4d9cfe43c46a3206cc169cbe2c8fb17821f25.zip
Merge branch 'bjorn/cover'
* bjorn/cover: test_server: Sort cover-analysed modules cover: Optimize file operations
Diffstat (limited to 'lib')
-rw-r--r--lib/test_server/src/test_server.erl4
-rw-r--r--lib/tools/src/cover.erl28
2 files changed, 17 insertions, 15 deletions
diff --git a/lib/test_server/src/test_server.erl b/lib/test_server/src/test_server.erl
index 1d989ce9c8..a4f7d24540 100644
--- a/lib/test_server/src/test_server.erl
+++ b/lib/test_server/src/test_server.erl
@@ -266,9 +266,9 @@ cover_analyse(Dir,#cover{level=Analyse,mods=Modules,stop=Stop}) ->
end
end,
{result,AOk,AFail} = cover:analyse(Modules,module),
- R = merge_analysis_results(AOk,ATFOk++ATFFail,[]) ++
+ R0 = merge_analysis_results(AOk,ATFOk++ATFFail,[]) ++
[{M,{error,Reason}} || {Reason,M} <- AFail],
-
+ R = lists:sort(R0),
io:fwrite(user, "done\n\n", []),
case Stop of
diff --git a/lib/tools/src/cover.erl b/lib/tools/src/cover.erl
index 9a76084bc0..6c32c47069 100644
--- a/lib/tools/src/cover.erl
+++ b/lib/tools/src/cover.erl
@@ -2377,9 +2377,9 @@ do_analyse_to_file(Module,File,OutFile,HTML,State) ->
%% Module = atom()
%% OutFile = ErlFile = string()
do_analyse_to_file1(Module, OutFile, ErlFile, HTML) ->
- case file:open(ErlFile, [read]) of
+ case file:open(ErlFile, [read,raw,read_ahead]) of
{ok, InFd} ->
- case file:open(OutFile, [write]) of
+ case file:open(OutFile, [write,raw,delayed_write]) of
{ok, OutFd} ->
if HTML ->
Encoding = encoding(ErlFile),
@@ -2422,7 +2422,9 @@ do_analyse_to_file1(Module, OutFile, ErlFile, HTML) ->
CovLines = lists:keysort(1,ets:select(?COLLECTION_TABLE, MS)),
print_lines(Module, CovLines, InFd, OutFd, 1, HTML),
- if HTML -> io:format(OutFd,"</pre>\n</body>\n</html>\n",[]);
+ if
+ HTML ->
+ file:write(OutFd, "</pre>\n</body>\n</html>\n");
true -> ok
end,
@@ -2441,13 +2443,13 @@ do_analyse_to_file1(Module, OutFile, ErlFile, HTML) ->
print_lines(Module, CovLines, InFd, OutFd, L, HTML) ->
- case io:get_line(InFd, '') of
+ case file:read_line(InFd) of
eof ->
ignore;
- "%"++_=Line -> %Comment line - not executed.
- io:put_chars(OutFd, [tab(),escape_lt_and_gt(Line, HTML)]),
+ {ok,"%"++_=Line} -> %Comment line - not executed.
+ file:write(OutFd, [tab(),escape_lt_and_gt(Line, HTML)]),
print_lines(Module, CovLines, InFd, OutFd, L+1, HTML);
- RawLine ->
+ {ok,RawLine} ->
Line = escape_lt_and_gt(RawLine,HTML),
case CovLines of
[{L,N}|CovLines1] ->
@@ -2459,20 +2461,20 @@ print_lines(Module, CovLines, InFd, OutFd, L, HTML) ->
%%Str = string:right("0", 6, 32),
RedLine = ["<font color=red>",Str,fill1(),
LineNoNL,"</font>\n"],
- io:put_chars(OutFd, RedLine);
+ file:write(OutFd, RedLine);
N<1000000 ->
Str = string:right(integer_to_list(N), 6, 32),
- io:put_chars(OutFd, [Str,fill1(),Line]);
+ file:write(OutFd, [Str,fill1(),Line]);
N<10000000 ->
Str = integer_to_list(N),
- io:put_chars(OutFd, [Str,fill2(),Line]);
+ file:write(OutFd, [Str,fill2(),Line]);
true ->
Str = integer_to_list(N),
- io:put_chars(OutFd, [Str,fill3(),Line])
+ file:write(OutFd, [Str,fill3(),Line])
end,
print_lines(Module, CovLines1, InFd, OutFd, L+1, HTML);
_ ->
- io:put_chars(OutFd, [tab(),Line]),
+ file:write(OutFd, [tab(),Line]),
print_lines(Module, CovLines, InFd, OutFd, L+1, HTML)
end
end.
@@ -2484,7 +2486,7 @@ fill3() -> "| ".
%%%--Export--------------------------------------------------------------
do_export(Module, OutFile, From, State) ->
- case file:open(OutFile,[write,binary,raw]) of
+ case file:open(OutFile,[write,binary,raw,delayed_write]) of
{ok,Fd} ->
Reply =
case Module of