View Source recon_lib (recon v2.5.3)

Regroups useful functionality used by recon when dealing with data from the node. The functions in this module allow quick runtime access to fancier behaviour than what would be done using recon module itself.

Link to this section Summary

Functions

Takes a list of terms, and counts how often each of them appears in the list. The list returned is in no particular order.
Returns the attributes (recon:inet_attrs()) of all inet ports (UDP, SCTP, TCP) of the node.
Returns the attributes required for a given inet port (UDP, SCTP, TCP). This form of attributes is standard for most comparison functions for processes in recon.
Returns a list of all the open ports in the VM, coupled with one of the properties desired from erlang:port_info/1-2.
Returns a list of all the open ports in the VM, but only if the Attr's resulting value matches Val. Attr must be a property accepted by erlang:port_info/2.
Returns the attributes (recon:proc_attrs()) of all processes of the node, except the caller.

Returns the attributes of a given process. This form of attributes is standard for most comparison functions for processes in recon.

Runs a fun once, waits Ms, runs the fun again, and returns both results.
Diffs two runs of erlang:statistics(scheduler_wall_time) and returns usage metrics in terms of cores and 0..1 percentages.
Compare two samples and return a list based on some key. The type mentioned for the structure is diff() ({Key,Val,Other}), which is compatible with the recon:proc_attrs() type.
Returns the top n element of a list of process or inet attributes
Transforms a given term to a pid.
Transforms a given term to a port
Calls a given function every Interval milliseconds and supports a fold-like interface (each result is modified and accumulated)
Calls a given function every Interval milliseconds and supports a map-like interface (each result is modified and returned)
Equivalent of pid(X,Y,Z) in the Erlang shell.

Link to this section Types

Link to this section Functions

-spec count([term()]) -> [{term(), Count :: integer()}].
Takes a list of terms, and counts how often each of them appears in the list. The list returned is in no particular order.
-spec inet_attrs(term()) -> [recon:inet_attrs()].
Returns the attributes (recon:inet_attrs()) of all inet ports (UDP, SCTP, TCP) of the node.
Link to this function

inet_attrs(AttributeName, Port)

View Source
-spec inet_attrs(AttributeName, port()) -> {ok, recon:inet_attrs()} | {error, term()}
              when AttributeName :: recv_cnt | recv_oct | send_cnt | send_oct | cnt | oct.
Returns the attributes required for a given inet port (UDP, SCTP, TCP). This form of attributes is standard for most comparison functions for processes in recon.
-spec port_list(Attr :: atom()) -> [{port(), term()}].
Returns a list of all the open ports in the VM, coupled with one of the properties desired from erlang:port_info/1-2.
-spec port_list(Attr :: atom(), term()) -> [port()].
Returns a list of all the open ports in the VM, but only if the Attr's resulting value matches Val. Attr must be a property accepted by erlang:port_info/2.
-spec proc_attrs(term()) -> [recon:proc_attrs()].
Returns the attributes (recon:proc_attrs()) of all processes of the node, except the caller.
Link to this function

proc_attrs(AttrName, Pid)

View Source
-spec proc_attrs(term(), pid()) -> {ok, recon:proc_attrs()} | {error, term()}.

Returns the attributes of a given process. This form of attributes is standard for most comparison functions for processes in recon.

A special attribute is binary_memory, which will reduce the memory used by the process for binary data on the global heap.
-spec sample(Ms :: non_neg_integer(), fun(() -> term())) -> {First :: term(), Second :: term()}.
Runs a fun once, waits Ms, runs the fun again, and returns both results.
Link to this function

scheduler_usage_diff(SchedTime, SchedTime)

View Source
-spec scheduler_usage_diff(SchedTime, SchedTime) -> undefined | [{SchedulerId, Usage}]
                        when
                            SchedTime :: [{SchedulerId, ActiveTime, TotalTime}],
                            SchedulerId :: pos_integer(),
                            Usage :: number(),
                            ActiveTime :: non_neg_integer(),
                            TotalTime :: non_neg_integer().
Diffs two runs of erlang:statistics(scheduler_wall_time) and returns usage metrics in terms of cores and 0..1 percentages.
Link to this function

sliding_window(First, Last)

View Source
-spec sliding_window(First :: diff(), Last :: diff()) -> diff().
Compare two samples and return a list based on some key. The type mentioned for the structure is diff() ({Key,Val,Other}), which is compatible with the recon:proc_attrs() type.
Link to this function

sublist_top_n_attrs(List, Len)

View Source
-spec sublist_top_n_attrs([Attrs], pos_integer()) -> [Attrs]
                       when Attrs :: recon:proc_attrs() | recon:inet_attrs().
Returns the top n element of a list of process or inet attributes
-spec term_to_pid(recon:pid_term()) -> pid().
Transforms a given term to a pid.
-spec term_to_port(recon:port_term()) -> port().
Transforms a given term to a port
Link to this function

time_fold(N, Interval, Fun, State, FoldFun, Init)

View Source
-spec time_fold(N, Interval, Fun, State, FoldFun, Init) -> [term()]
             when
                 N :: non_neg_integer(),
                 Interval :: pos_integer(),
                 Fun :: fun((State) -> {term(), State}),
                 State :: term(),
                 FoldFun :: fun((term(), Init) -> Init),
                 Init :: term().
Calls a given function every Interval milliseconds and supports a fold-like interface (each result is modified and accumulated)
Link to this function

time_map(N, Interval, Fun, State, MapFun)

View Source
-spec time_map(N, Interval, Fun, State, MapFun) -> [term()]
            when
                N :: non_neg_integer(),
                Interval :: pos_integer(),
                Fun :: fun((State) -> {term(), State}),
                State :: term(),
                MapFun :: fun((_) -> term()).
Calls a given function every Interval milliseconds and supports a map-like interface (each result is modified and returned)
-spec triple_to_pid(N, N, N) -> pid() when N :: non_neg_integer().
Equivalent of pid(X,Y,Z) in the Erlang shell.