From 7b2c17955337b6c171e43c4eddb44508a8667bb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Wed, 9 Jun 2010 16:36:56 +0200 Subject: Dialyzer cleanup for eprof --- lib/tools/src/eprof.erl | 22 ++++++---------------- lib/tools/test/eprof_SUITE.erl | 5 ++--- 2 files changed, 8 insertions(+), 19 deletions(-) (limited to 'lib/tools') diff --git a/lib/tools/src/eprof.erl b/lib/tools/src/eprof.erl index 6a0bd9ff9c..bb082a4c66 100644 --- a/lib/tools/src/eprof.erl +++ b/lib/tools/src/eprof.erl @@ -348,12 +348,12 @@ set_process_trace(Flag, Pids) -> set_process_trace(_, [], _) -> true; set_process_trace(Flag, [Pid|Pids], Options) when is_pid(Pid) -> try - erlang:trace(Pid, Flag, Options) + erlang:trace(Pid, Flag, Options), + set_process_trace(Flag, Pids, Options) catch _:_ -> false - end, - set_process_trace(Flag, Pids, Options); + end; set_process_trace(Flag, [Name|Pids], Options) when is_atom(Name) -> case whereis(Name) of undefined -> @@ -466,10 +466,10 @@ print_bp_mfa(Mfas, {_Tn, Tus}, Fd, Opts) -> erlang:max(length("TIME"), TimeW), erlang:max(length("uS / CALLS"), TpCW) }, - print(Fd, Ws, ["FUNCTION", "CALLS", " %", "TIME", "uS / CALLS"]), - print(Fd, Ws, ["--------", "-----", "---", "----", "----------"]), + format(Fd, Ws, ["FUNCTION", "CALLS", " %", "TIME", "uS / CALLS"]), + format(Fd, Ws, ["--------", "-----", "---", "----", "----------"]), - lists:foreach(fun (String) -> print(Fd, Ws, String) end, Strs), + lists:foreach(fun (String) -> format(Fd, Ws, String) end, Strs), ok. s({M,F,A}) -> s("~w:~w/~w",[M,F,A]); @@ -477,16 +477,6 @@ s(Term) -> s("~p", [Term]). s(Format, Terms) -> lists:flatten(io_lib:format(Format, Terms)). -print(Fd, [_,_,_] = Strings) -> - print(Fd, "~.44s ~14s ~14s~n", Strings); -print(Fd, [_,_,_,_] = Strings) -> - print(Fd, "~.44s ~14s ~14s ~7s ~n", Strings); -print(Fd, Strings) -> - print(Fd, "~.44s ~14s ~14s ~7s [~7s]~n", Strings). -print(Fd, Format, Strings) -> - format(Fd, Format, Strings). - - format(Fd, {MfaW, CountW, PercW, TimeW, TpCW}, Strings) -> format(Fd, s("~~.~ps ~~~ps ~~~ps ~~~ps [~~~ps]~~n", [MfaW, CountW, PercW, TimeW, TpCW]), Strings); format(undefined, Format, Strings) -> diff --git a/lib/tools/test/eprof_SUITE.erl b/lib/tools/test/eprof_SUITE.erl index 7e97db86b0..cad67fd617 100644 --- a/lib/tools/test/eprof_SUITE.erl +++ b/lib/tools/test/eprof_SUITE.erl @@ -59,18 +59,17 @@ basic(Config) when is_list(Config) -> ?line profiling_stopped = eprof:stop_profiling(), %% with fun - ?line {ok, _} = eprof:profile(fun() -> eprof_test:go(10) end), ?line profiling = eprof:profile([self()]), ?line {error, already_profiling} = eprof:profile(fun() -> eprof_test:go(10) end), ?line profiling_stopped = eprof:stop_profiling(), ?line {ok, _} = eprof:profile(fun() -> eprof_test:go(10) end), ?line {ok, _} = eprof:profile([], fun() -> eprof_test:go(10) end), - ?line {ok, _} = eprof:profile(erlang:processes(), fun() -> eprof_test:go(10) end), + ?line Pid = whereis(eprof), + ?line {ok, _} = eprof:profile(erlang:processes() -- [Pid], fun() -> eprof_test:go(10) end), ?line {ok, _} = eprof:profile([], fun() -> eprof_test:go(10) end, {eprof_test, '_', '_'}), ?line {ok, _} = eprof:profile([], fun() -> eprof_test:go(10) end, {eprof_test, go, '_'}), ?line {ok, _} = eprof:profile([], fun() -> eprof_test:go(10) end, {eprof_test, go, 1}), - ?line {ok, _} = eprof:profile([self()], fun() -> eprof_test:go(10) end, {eprof_test, go, 1}), ?line {ok, _} = eprof:profile([], fun() -> eprof_test:go(10) end, {eprof_test, dec, 1}), %% with mfa -- cgit v1.2.3