Module ep_prof

Call time profiler, and a series of helper functions.

Copyright © (C) 2019, Maxim Fedorov

Behaviours: gen_server.

Authors: Maxim Fedorov (maximfca@gmail.com).

Description

Call time profiler, and a series of helper functions.

Data Types

caller()

caller() = {CallerMod::module(), CallerFun::atom(), CallerArity::non_neg_integer(), CallerCount::pos_integer()}

module_time()

module_time() = {Module::module(), [{Fun::atom(), Arity::non_neg_integer(), Count::non_neg_integer(), TimeMs::non_neg_integer()}]}

module_trace()

module_trace() = {Module::module(), [{Fun::atom(), Arity::non_neg_integer(), Count::non_neg_integer(), TimeMs::non_neg_integer(), [caller()]}]}

pid_port_spec()

pid_port_spec() = pid() | port() | all | processes | ports | existing | existing_processes | existing_ports | new | new_processes | new_ports

progress_callback()

progress_callback() = silent | {module(), atom(), term()}

Function Index

collect/0
collect/1
format/0
format/1
format_callgrind/1
handle_cast/2
handle_info/2
init/1
record/2 Traces calls to MFA and records arguments passed.
sample/4 Records samples of calls to any function in MFA list passed.
start/0 Starts call tracing profiler outside of supervision tree.
start_link/0 Starts call tracing profiler as a part of supervision tree.
start_trace/0
start_trace/1
stop/0 Stops call tracing profiler.
stop/1
stop_trace/0
terminate/2
time/1 Performs call time tracing for all processes, all modules and all functions.
time/4 Performs call time tracing for specific processes, modules or functions.
trace/1 Performs call time tracing for all processes, all modules and all functions, and also collects information about the caller.
trace/4 Performs call time tracing, and collects information about the caller.

Function Details

collect/0

collect() -> any()

collect/1

collect(Options0) -> any()

format/0

format() -> any()

format/1

format(Options0) -> any()

format_callgrind/1

format_callgrind(Data) -> any()

handle_cast/2

handle_cast(Request, State) -> any()

handle_info/2

handle_info(Info::timeout() | term(), State::#state{tracing = boolean(), tracer = undefined | pid(), call_time = undefined | [{module(), [{{Fun::atom(), non_neg_integer()}, Count::non_neg_integer(), Time::non_neg_integer()}]}], samples = undefined | {[{module(), atom(), non_neg_integer(), term()}], term()}, traced_procs = term()}) -> {noreply, NewState::#state{tracing = boolean(), tracer = undefined | pid(), call_time = undefined | [{module(), [{{Fun::atom(), non_neg_integer()}, Count::non_neg_integer(), Time::non_neg_integer()}]}], samples = undefined | {[{module(), atom(), non_neg_integer(), term()}], term()}, traced_procs = term()}} | {noreply, NewState::#state{tracing = boolean(), tracer = undefined | pid(), call_time = undefined | [{module(), [{{Fun::atom(), non_neg_integer()}, Count::non_neg_integer(), Time::non_neg_integer()}]}], samples = undefined | {[{module(), atom(), non_neg_integer(), term()}], term()}, traced_procs = term()}, timeout() | hibernate} | {stop, Reason::term(), NewState::#state{tracing = boolean(), tracer = undefined | pid(), call_time = undefined | [{module(), [{{Fun::atom(), non_neg_integer()}, Count::non_neg_integer(), Time::non_neg_integer()}]}], samples = undefined | {[{module(), atom(), non_neg_integer(), term()}], term()}, traced_procs = term()}}

init/1

init(Args::term()) -> {ok, State::#state{tracing = boolean(), tracer = undefined | pid(), call_time = undefined | [{module(), [{{Fun::atom(), non_neg_integer()}, Count::non_neg_integer(), Time::non_neg_integer()}]}], samples = undefined | {[{module(), atom(), non_neg_integer(), term()}], term()}, traced_procs = term()}}

record/2

record(TimeMs::non_neg_integer(), MFA::{Mod::module() | '_', Fun::atom() | '_', Arity::non_neg_integer() | '_'}) -> [[term()]] | not_found

Traces calls to MFA and records arguments passed.

sample/4

sample(PidPortSpec, TimeMs, MFAList, Progress) -> any()

Records samples of calls to any function in MFA list passed.

start/0

start() -> {ok, Pid::pid()} | ignore | {error, Reason::term()}

Starts call tracing profiler outside of supervision tree.

start_link/0

start_link() -> {ok, Pid::pid()} | ignore | {error, Reason::term()}

Starts call tracing profiler as a part of supervision tree

start_trace/0

start_trace() -> any()

start_trace/1

start_trace(Options0) -> any()

stop/0

stop() -> any()

Stops call tracing profiler

stop/1

stop(Timeout::integer() | infinity) -> ok

stop_trace/0

stop_trace() -> any()

terminate/2

terminate(Reason::normal | shutdown | {shutdown, term()} | term(), State::#state{tracing = boolean(), tracer = undefined | pid(), call_time = undefined | [{module(), [{{Fun::atom(), non_neg_integer()}, Count::non_neg_integer(), Time::non_neg_integer()}]}], samples = undefined | {[{module(), atom(), non_neg_integer(), term()}], term()}, traced_procs = term()}) -> term()

time/1

time(TimeMs::non_neg_integer()) -> [module_time()]

TimeMs: milliseconds to wait. Does not collect any call stacks. Fast enough to be used even on highly-loaded systems running thousands of processes.

Performs call time tracing for all processes, all modules and all functions.

See also: erlang:trace/3.

time/4

time(TimeMs::non_neg_integer(), PidPortSpec::pid_port_spec(), MFAList::erlang:trace_pattern_mfa(), Progress::progress_callback()) -> [module_time()]

Performs call time tracing for specific processes, modules or functions. Accepts a progress report callback.

trace/1

trace(TimeMs::non_neg_integer()) -> [module_trace()]

TimeMs: milliseconds to wait

Performs call time tracing for all processes, all modules and all functions, and also collects information about the caller. This is considerably slower than using time/1, because actual tracing is being used.

trace/4

trace(TimeMs::non_neg_integer(), PidPortSpec::pid_port_spec(), MFAList::erlang:trace_pattern_mfa(), Progress::progress_callback()) -> [module_trace()]

Performs call time tracing, and collects information about the caller.


Generated by EDoc