diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/runtime_tools/src/percept_profile.erl | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/lib/runtime_tools/src/percept_profile.erl b/lib/runtime_tools/src/percept_profile.erl index b333dee0cf..5d36b6bd0c 100644 --- a/lib/runtime_tools/src/percept_profile.erl +++ b/lib/runtime_tools/src/percept_profile.erl @@ -41,7 +41,7 @@ %% @type percept_option() = procs | ports | exclusive --type(percept_option() :: 'procs' | 'ports' | 'exclusive' | 'scheduler'). +-type percept_option() :: 'procs' | 'ports' | 'exclusive' | 'scheduler'. %%========================================================================== %% @@ -52,8 +52,8 @@ %% @spec start(Filename::string()) -> {ok, Port} | {already_started, Port} %% @equiv start(Filename, [procs]) --spec(start/1 :: (Filename :: string()) -> - {'ok', port()} | {'already_started', port()}). +-spec start(Filename :: file:filename()) -> + {'ok', port()} | {'already_started', port()}. start(Filename) -> profile_to_file(Filename, [procs]). @@ -64,10 +64,9 @@ start(Filename) -> %% All events are stored in the file given by Filename. %% An explicit call to stop/0 is needed to stop profiling. --spec(start/2 :: ( - Filename :: string(), - Options :: [percept_option()]) -> - {'ok', port()} | {'already_started', port()}). +-spec start(Filename :: file:filename(), + Options :: [percept_option()]) -> + {'ok', port()} | {'already_started', port()}. start(Filename, Options) -> profile_to_file(Filename, Options). @@ -79,11 +78,10 @@ start(Filename, Options) -> %% No explicit call to stop/0 is needed, the profiling stops when %% the entry function returns. --spec(start/3 :: ( - Filename :: string(), - Entry :: {atom(), atom(), list()}, - Options :: [percept_option()]) -> - 'ok' | {'already_started', port()} | {'error', 'not_started'}). +-spec start(Filename :: file:filename(), + Entry :: {atom(), atom(), list()}, + Options :: [percept_option()]) -> + 'ok' | {'already_started', port()} | {'error', 'not_started'}. start(Filename, {Module, Function, Args}, Options) -> case whereis(percept_port) of @@ -107,11 +105,11 @@ deliver_all_trace() -> receive {Tracer, ok} -> ok end, erlang:trace(Tracee, false, [procs]), ok. --spec(stop/0 :: () -> 'ok' | {'error', 'not_started'}). %% @spec stop() -> ok | {'error', 'not_started'} %% @doc Stops profiling. +-spec stop() -> 'ok' | {'error', 'not_started'}. stop() -> erlang:system_profile(undefined, [runnable_ports, runnable_procs]), @@ -192,5 +190,4 @@ parse_profile_options([Opt|Opts], {TOpts, POpts}) -> }); _ -> parse_profile_options(Opts, {TOpts, POpts}) - end. |