Module recon_lib
Regroups useful functionality used by recon when dealing with data from the node.Authors: Fred Hebert (mononcqc@ferd.ca
) [web site: http://ferd.ca/
].
Description
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.Data Types
diff()
diff() = [recon:proc_attrs() | recon:inet_attrs()]
Function Index
count/1 | Takes a list of terms, and counts how often each of them appears in the list. |
inet_attrs/1 | Returns the attributes (recon:inet_attrs() ) of
all inet ports (UDP, SCTP, TCP) of the node. |
inet_attrs/2 | Returns the attributes required for a given inet port (UDP, SCTP, TCP). |
port_list/1 | Returns a list of all the open ports in the VM, coupled with
one of the properties desired from erlang:port_info/1-2 . |
port_list/2 | Returns a list of all the open ports in the VM, but only
if the Attr 's resulting value matches Val . |
proc_attrs/1 | Returns the attributes (recon:proc_attrs() ) of
all processes of the node, except the caller. |
proc_attrs/2 | Returns the attributes of a given process. |
sample/2 | Runs a fun once, waits Ms , runs the fun again,
and returns both results. |
sliding_window/2 | Compare two samples and return a list based on some key. |
term_to_pid/1 | Transforms a given term to a pid. |
term_to_port/1 | Transforms a given term to a port. |
time_fold/6 | Calls a given function every Interval milliseconds and supports
a fold-like interface (each result is modified and accumulated). |
time_map/5 | Calls a given function every Interval milliseconds and supports
a map-like interface (each result is modified and returned). |
triple_to_pid/3 | Equivalent of pid(X,Y,Z) in the Erlang shell. |
Function Details
count/1
count(Terms::[term()]) -> [{Count::integer(), term()}]
Takes a list of terms, and counts how often each of them appears in the list. The list returned is in no particular order.
inet_attrs/1
inet_attrs(AttrName::term()) -> [recon:inet_attrs()]
Returns the attributes (recon:inet_attrs()
) of
all inet ports (UDP, SCTP, TCP) of the node.
inet_attrs/2
inet_attrs(AttributeName, Port::port()) -> {ok, recon:inet_attrs()} | {error, term()}
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.
port_list/1
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
.
port_list/2
port_list(Attr::atom(), Val::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
.
proc_attrs/1
proc_attrs(AttrName::term()) -> [recon:proc_attrs()]
Returns the attributes (recon:proc_attrs()
) of
all processes of the node, except the caller.
proc_attrs/2
proc_attrs(AttrName::term(), Pid::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 isbinary_memory
, which will reduce the memory used
by the process for binary data on the global heap.
sample/2
sample(Ms::non_neg_integer(), Fun::fun(() -> term())) -> {First::term(), Second::term()}
Runs a fun once, waits Ms
, runs the fun again,
and returns both results.
sliding_window/2
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.
term_to_pid/1
term_to_pid(Pid::recon:pid_term()) -> pid()
Transforms a given term to a pid.
term_to_port/1
term_to_port(Port::recon:port_term()) -> port()
Transforms a given term to a port
time_fold/6
time_fold(N, Interval, Fun, State, FoldFun, Init) -> [term()]
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)
time_map/5
time_map(N, Interval, Fun, State, MapFun) -> [term()]
N = non_neg_integer()
Interval = pos_integer()
Fun = fun((State) -> {term(), State})
State = term()
MapFun = fun((term()) -> term())
Calls a given function every Interval
milliseconds and supports
a map-like interface (each result is modified and returned)
triple_to_pid/3
triple_to_pid(N, N, N) -> pid()
N = non_neg_integer()
Equivalent of pid(X,Y,Z)
in the Erlang shell.