XProf v2.0.0-rc.4 xprof_core View Source

Link to this section Summary

Types

Command name.

Used by the GUI and xprof_core_tracer to identify mfas. Arity of '_' means all arities. Similar to type erlang:trace_pattern_mfa().

Derived from mfa_id. Used to register ets tables and xprof_core_trace_handler gen_servers.

Traced function with optional match-spec. Used to initiate tracing (both by xprof_core_tracer and xprof_core_trace_handler).

Accepted syntax mode.

Match-specification.

Internal representation of params

Parameter name passed to commands.

Parameters passed to commands.

Unix timestamp.

Functions

Start capturing arguments and return values of function calls that lasted longer than the specified time threshold in ms.

Stop capturing long calls of the given function.

Stop monitoring the specified function (MFA).

Get expansion suggestions for the given possibly incomplete query.

Return list of monitored functions (both as MFA and the original query string).

Return list of called functions for given mfa tuple.

Return list of called functions formatted according to the active syntax mode.

Return captured arguments and return values.

Return captured arguments and return values formatted according to the active syntax mode.

Return metrics gathered for the given function since the given timestamp.

Return metrics gathered for the given function formatted according to the active syntax mode.

Get loaded modules and functions (MFAs) that match the query string.

Get syntax mode.

Return current tracing state.

Start monitoring the specified function (MFA).

Start the specified command.

Start monitoring based on the specified query string.

Start monitoring based on the specified query string with additional parameters.

Remove all record definitions. (similar to shell command rf('_'))

Remove selected record definitions.

Return all stored record definitions. (Similar to shell command rl/0)

Load record definitions from module. (similar to shell command rr/1)

Set syntax mode explicitely.

Turn on tracing for one or all processes.

Link to this section Types

Command name.

Link to this type

mfa_id()

View Source
mfa_id() :: {module(), atom(), arity() | '_'}.

Used by the GUI and xprof_core_tracer to identify mfas. Arity of '_' means all arities. Similar to type erlang:trace_pattern_mfa().

Link to this type

mfa_name()

View Source
mfa_name() :: atom().

Derived from mfa_id. Used to register ets tables and xprof_core_trace_handler gen_servers.

Link to this type

mfa_spec()

View Source
mfa_spec() :: {mfa_id(), {ms(), ms()}}.

Traced function with optional match-spec. Used to initiate tracing (both by xprof_core_tracer and xprof_core_trace_handler).

Link to this type

mode()

View Source
mode() :: erlang | elixir.

Accepted syntax mode.

Match-specification.

Link to this type

options()

View Source
options() ::
    [{mfa, string()} | {atom(), erl_parse:abstract_expr()}].

Internal representation of params

Link to this type

param_name()

View Source
param_name() :: atom().

Parameter name passed to commands.

Link to this type

params()

View Source
params() :: [{param_name(), term()}].

Parameters passed to commands.

Unix timestamp.

Link to this section Functions

Link to this function

capture/3

View Source
capture(xprof_core:mfa_id(), non_neg_integer(), non_neg_integer()) ->
           {ok, CaptureId :: non_neg_integer()} |
           {error, not_found}.

Start capturing arguments and return values of function calls that lasted longer than the specified time threshold in ms.

Link to this function

capture_stop/1

View Source
capture_stop(xprof_core:mfa_id()) ->
                ok | {error, not_found | not_captured}.

Stop capturing long calls of the given function.

Link to this function

demonitor/1

View Source
demonitor(xprof_core:mfa_id()) -> ok.

Stop monitoring the specified function (MFA).

Link to this function

expand_query/1

View Source
expand_query(binary()) -> {CommonPrefix :: binary(), [Match]}
                when
                    Match ::
                        {Prefix :: binary(), Label :: binary()}.

Get expansion suggestions for the given possibly incomplete query.

Link to this function

get_all_monitored/0

View Source
get_all_monitored() -> [{xprof_core:mfa_id(), Query :: binary()}].

Return list of monitored functions (both as MFA and the original query string).

Link to this function

get_called_funs/1

View Source
get_called_funs(xprof_core:mfa_id()) -> [xprof_core:mfa_id()].

Return list of called functions for given mfa tuple.

Link to this function

get_called_funs_pp/1

View Source
get_called_funs_pp(xprof_core:mfa_id()) -> [MFA :: binary()].

Return list of called functions formatted according to the active syntax mode.

Link to this function

get_captured_data/2

View Source
get_captured_data(xprof_core:mfa_id(),
                  Offset :: non_neg_integer()) ->
                     {ok, CaptureSpec, [Item]} |
                     {error, not_found}
                     when
                         CaptureSpec ::
                             {CaptureId :: non_neg_integer(),
                              Threshold :: non_neg_integer(),
                              Limit :: non_neg_integer(),
                              HasMore :: boolean()},
                         Item ::
                             {Index :: non_neg_integer(),
                              CallingProcess :: pid(),
                              CallTimeMs :: non_neg_integer(),
                              Args :: list(),
                              Result :: term()}.

Return captured arguments and return values.

The Offset argument is the item index last seen by the caller, only items newer than that will be returned. An offset of 0 will return all data.

The returned HasMore indicates whether capturing is still ongoing or it has been stopped either manually or by reaching the limit.

Link to this function

get_captured_data_pp/2

View Source
get_captured_data_pp(xprof_core:mfa_id(),
                     Offset :: non_neg_integer()) ->
                        {ok, CaptureSpec, Items} |
                        {error, not_found}
                        when
                            CaptureSpec ::
                                {CaptureId :: non_neg_integer(),
                                 Threshold :: non_neg_integer(),
                                 Limit :: non_neg_integer(),
                                 HasMore :: boolean()},
                            Items :: [{proplists:proplist()}].

Return captured arguments and return values formatted according to the active syntax mode.

Link to this function

get_data/2

View Source
get_data(xprof_core:mfa_id(), timestamp()) ->
            [Item] | {error, not_found}
            when
                Item ::
                    [{time, timestamp()} | {HistKey, number()}],
                HistKey ::
                    min | mean | median | max | stddev | p25 |
                    p50 | p75 | p90 | p99 | p9999999 | memsize |
                    count.

Return metrics gathered for the given function since the given timestamp.

Each item contains a timestamp and the corresponding histogram metrics values.

Return metrics gathered for the given function formatted according to the active syntax mode.

Link to this function

get_matching_mfas_pp/1

View Source
get_matching_mfas_pp(binary()) -> [MFA :: binary()].

Get loaded modules and functions (MFAs) that match the query string.

Used for autocomplete suggestions on the GUI.

Link to this function

get_mode/0

View Source
get_mode() -> xprof_core:mode().

Get syntax mode.

If not set explicitely it will be autodetected.

Link to this function

get_trace_status/0

View Source
get_trace_status() ->
                    {pid() | all,
                     Status ::
                         initialized | running | paused | overflow}.

Return current tracing state.

(The initialized status is basically the same as paused, additionally meaning that no tracing was started yet since xprof was started)

Link to this function

monitor/1

View Source
monitor(mfa()) ->
           ok | {error, Reason :: already_traced | string()}.

Start monitoring the specified function (MFA).

Link to this function

monitor/2

View Source
monitor(cmd(), params()) -> ok | {error, Reason :: term()}.

Start the specified command.

Link to this function

monitor_pp/1

View Source
monitor_pp(binary()) ->
              ok | {error, Reason :: already_traced | string()}.

Start monitoring based on the specified query string.

Link to this function

monitor_pp/2

View Source
monitor_pp(binary(), [{binary(), binary()}]) ->
              ok | {error, Reason :: already_traced | string()}.

Start monitoring based on the specified query string with additional parameters.

Additional parameters have precedence overthe same keys in the query.

Remove all record definitions. (similar to shell command rf('_'))

Remove selected record definitions.

The argument can be a record name or a list of record names. To remove all record definitions, use '_'. (similar to shell command rf/1)

Return all stored record definitions. (Similar to shell command rl/0)

Link to this function

rr/1

View Source
rr(module()) -> [RecName :: atom()].

Load record definitions from module. (similar to shell command rr/1)

Link to this function

set_mode/1

View Source
set_mode(xprof_core:mode()) -> ok.

Set syntax mode explicitely.

Link to this function

trace/1

View Source
trace(pid() | all | pause | resume) -> ok.

Turn on tracing for one or all processes.

Additionally tracing can be paused and resumed for the same process specification (one or all) that was given earlier.