diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/hipe/cerl/erl_bif_types.erl | 5 | ||||
-rw-r--r-- | lib/tools/src/eprof.erl | 22 | ||||
-rw-r--r-- | lib/tools/test/eprof_SUITE.erl | 5 |
3 files changed, 11 insertions, 21 deletions
diff --git a/lib/hipe/cerl/erl_bif_types.erl b/lib/hipe/cerl/erl_bif_types.erl index 838f9429f0..9df3dedb45 100644 --- a/lib/hipe/cerl/erl_bif_types.erl +++ b/lib/hipe/cerl/erl_bif_types.erl @@ -4026,7 +4026,8 @@ arg_types(erlang, trace_info, 2) -> t_atom('flags'), t_atom('tracer'), %% while the following are items about a func t_atom('traced'), t_atom('match_spec'), t_atom('meta'), - t_atom('meta_match_spec'), t_atom('call_count'), t_atom('all')])]; + t_atom('meta_match_spec'), t_atom('call_count'), + t_atom('call_time'), t_atom('all')])]; arg_types(erlang, trace_pattern, 2) -> [t_sup(t_tuple([t_atom(), t_atom(), t_sup(t_arity(), t_atom('_'))]), t_atom('on_load')), @@ -4035,7 +4036,7 @@ arg_types(erlang, trace_pattern, 3) -> arg_types(erlang, trace_pattern, 2) ++ [t_list(t_sup([t_atom('global'), t_atom('local'), t_atom('meta'), t_tuple([t_atom('meta'), t_pid()]), - t_atom('call_count')]))]; + t_atom('call_count'), t_atom('call_time')]))]; arg_types(erlang, trunc, 1) -> [t_number()]; arg_types(erlang, tuple_size, 1) -> 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 |