View Source tr (erlang_doctor v0.2.1)

Summary

Types

-type acc_time() :: non_neg_integer().
-type call() :: {call, {module(), atom(), list()}}.
-type call_count() :: non_neg_integer().
Link to this type

call_tree_stat_options/0

View Source
-type call_tree_stat_options() :: #{tab => atom()}.
Link to this type

call_tree_stat_state/0

View Source
-type call_tree_stat_state() :: #{pid_states := map(), tab := ets:tid()}.
-type count() :: pos_integer().
-type erlang_trace_flags() :: [call | timestamp | send | 'receive'].
-type index() :: pos_integer().
-type init_options() :: #{tab => atom(), index => index(), limit => limit()}.
-type limit() :: pos_integer() | infinity.
used for a few different limits
-type module_spec() :: [module() | mfa()].
-type own_time() :: non_neg_integer().
-type pid_call_state() :: [tree() | call()].
-type pids() :: [pid()] | all.
-type pred() :: fun((tr()) -> boolean()).
-type range_options() :: #{tab => atom() | [tr()], max_depth => limit()}.
-type result() :: {return | exception, any()}.
-type selector() :: fun((tr()) -> term()).
-type simple_tr() :: call() | result().
-type state() ::
    #{tab := atom(),
      index := index(),
      limit := limit(),
      trace := none | trace_spec(),
      traced_pids := traced_pids_tab()}.
-type tb_acc() :: tb_acc_tree() | tb_acc_list().
-type tb_acc_list() :: [[tr()]].
-type tb_acc_tree() :: [{tr(), tb_acc_tree()}].
-type tb_format() :: tree | list.
-type tb_options() ::
    #{tab => atom() | [tr()],
      output => tb_output(),
      format => tb_format(),
      order => tb_order(),
      limit => limit()}.
-type tb_order() :: top_down | bottom_up.
-type tb_output() :: shortest | longest | all.
-type tb_tree() :: [tr() | {tr(), tb_tree()}].
-type time_diff() :: integer().
Link to this type

top_call_trees_options/0

View Source
-type top_call_trees_options() ::
    #{max_size => pos_integer(),
      min_count => count(),
      min_time => time_diff(),
      output => top_call_trees_output()}.
Link to this type

top_call_trees_output/0

View Source
-type top_call_trees_output() :: reduced | complete.
-type tr() :: #tr{}.
-type trace_options() ::
    #{modules => module_spec(),
      pids => pids(),
      msg => send | recv | all | none,
      msg_trigger => always | after_traced_call}.
-type trace_spec() ::
    #{modules := module_spec(),
      pids := pids(),
      msg := send | recv | all | none,
      msg_trigger := always | after_traced_call}.
-type traced_pids_tab() :: none | ets:table().
-type tree() :: #node{}.
-type tree_item() :: {time_diff(), count(), tree()}.

Functions

-spec app_modules(atom()) -> [atom()].
-spec call_selector(fun((pid(), {atom(), atom(), [term()]}) -> term())) -> selector().
-spec call_stat(selector()) -> #{term() => {call_count(), acc_time(), own_time()}}.
-spec call_stat(selector(), atom() | [tr()]) -> #{term() => {call_count(), acc_time(), own_time()}}.
-spec call_tree_stat() -> ets:tid().
-spec call_tree_stat(call_tree_stat_options()) -> ets:tid().
-spec clean() -> ok.
Link to this function

code_change(OldVsn, State, Extra)

View Source
-spec code_change(any(), state(), any()) -> {ok, state()}.
Link to this function

contains_data(DataVal, Tr)

View Source
-spec contains_data(term(), tr()) -> boolean().
-spec do(tr()) -> term().
-spec dump(string()) -> ok | {error, any()}.
-spec filter(pred()) -> [tr()].
-spec filter(pred(), atom() | [tr()]) -> [tr()].
Link to this function

handle_call(Req, From, State)

View Source
-spec handle_call(any(), {pid(), any()}, state()) -> {reply, ok, state()}.
-spec handle_cast(any(), state()) -> {noreply, state()}.
Link to this function

handle_info(Trace, State)

View Source
-spec handle_info(any(), state()) -> {noreply, state()}.
-spec init(init_options()) -> {ok, state()}.
-spec load(string()) -> {ok, atom()} | {error, any()}.
-spec lookup(index()) -> tr().
-spec mfa({M, F, Arity}, Args) -> {M, F, Args}
       when M :: atom(), F :: atom(), Arity :: arity(), Args :: list().
-spec mfarity({M, F, Arity | Args}) -> {M, F, Arity}
           when M :: atom(), F :: atom(), Arity :: arity(), Args :: list().
-spec range(pred() | tr() | index()) -> [tr()].
-spec ranges(pred()) -> [[tr()]].
-spec ranges(pred(), range_options()) -> [[tr()]].
Link to this function

reduce_call_trees(TreeTab)

View Source
-spec reduce_call_trees(ets:tid()) -> true.
-spec select() -> [tr()].
-spec select(selector()) -> [term()].
-spec select(selector(), term()) -> [term()].
-spec set_tab(atom()) -> ok.
-spec sorted_call_stat(selector()) -> [{term(), call_count(), acc_time(), own_time()}].
-spec start() -> {ok, pid()}.
-spec start(init_options()) -> {ok, pid()}.
-spec start_link() -> {ok, pid()}.
-spec start_link(init_options()) -> {ok, pid()}.
-spec stop() -> ok.
-spec stop_tracing() -> ok.
-spec tab() -> atom().
-spec terminate(any(), state()) -> ok.
-spec top_call_trees() -> [tree_item()].
-spec top_call_trees(top_call_trees_options() | ets:tid()) -> [tree_item()].
Link to this function

top_call_trees(TreeTab, Options)

View Source
-spec top_call_trees(ets:tid(), top_call_trees_options()) -> [tree_item()].
-spec trace(module_spec() | trace_options()) -> ok.
-spec trace(module_spec(), pids()) -> ok.
-spec trace_app(atom()) -> ok.
-spec trace_apps([atom()]) -> ok.
-spec traceback(pred() | tr() | index()) -> [tr()].
Link to this function

traceback(PredF, Options)

View Source
-spec traceback(pred(), tb_options()) -> [tr()].
-spec tracebacks(pred()) -> [[tr()]] | tb_tree().
Link to this function

tracebacks(PredF, Options)

View Source
-spec tracebacks(pred(), tb_options()) -> [[tr()]] | tb_tree().
-spec ts(tr()) -> string().