ReconLib
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.
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/0) 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
and
:erlang.port_info/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/0
) 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
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 Elixir’s iex shell
Types
diff :: [Recon.proc_attrs | Recon.inet_attrs]
interval_ms :: non_neg_integer
milliseconds :: non_neg_integer
sched_time :: {scheduler_id, active_time :: non_neg_integer, total_time :: non_neg_integer}
scheduler_id :: pos_integer
Functions
Specs
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.
Specs
inet_attrs(term) :: [Recon.inet_attrs]
Returns the attributes (Recon.inet_attrs/0) of all inet ports (UDP, SCTP, TCP) of the node.
Specs
inet_attrs(Recon.inet_attri_name, port) ::
{:ok, Recon.inet_attrs} |
{:error, term}
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.
Specs
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
and
:erlang.port_info/2
Specs
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
.
Specs
proc_attrs(term) :: [Recon.proc_attrs]
Returns the attributes (Recon.proc_attrs/0
) of all processes of
the node, except the caller.
Specs
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.
Specs
sample(milliseconds, (() -> term)) :: {first :: term, second :: term}
Runs a fun once, waits ms
, runs the fun again, and returns both
results.
Specs
scheduler_usage_diff(sched_time, sched_time) :: [{scheduler_id, usage :: number}]
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.
Specs
time_fold(n :: non_neg_integer, interval_ms, fun :: (state :: term -> {term, state :: term}), initial_state :: term, foldfun :: (term, acc0 :: term -> acc1 :: term), initial_acc :: term) :: [term]
Calls a given function every interval
milliseconds and supports
a fold-like interface (each result is modified and accumulated)
Specs
time_map(n :: non_neg_integer, interval_ms, fun :: (state :: term -> {term, state :: term}), initial_state :: term, mapfun :: (term -> term)) :: [term]
Calls a given function every interval
milliseconds and supports
a map-like interface (each result is modified and returned)