Exrun v0.1.2 Tracer

Summary

Functions

get_config(key)
scheduler_usage(interval \\ 1000)

Scheduler usage based on scheduler wall time.

trace_off(options \\ [])

Stop tracing

trace_run(compiled_pattern, options \\ [])

Macros

trace(to_trace, options \\ [])

Options

The following options are available:

  • :node - specified the node, on which trace should be started.

  • :limit - specifies the limit, that should be used on collectable process. Limit options are merged with actually setted. It is possible to specify it per configuration as env :limit for application :exrun.

    The following limit options are available:

    • :time - specifies the time in milliseconds, where should the rate be applied. Default specified by environments. (Default: 1000)
    • :rate - specifies the limit of trace messages per time, if trace messages will be over this limit, the collectable process will stop and clear all traces. Default specified by environments. (Default: 100)
    • :overall - set the absolute limit for messages. After reaching this limit, the collactable process will clear all traces and stops. Default specified by environments. (Default: nil)
  • :formatter_local - flag for setting, where formatter process should be started. If set to false, then the formatter process will be started on remote node, if set to true, on a local machine. Defaults set to false. Tracer can trace on nodes, where elixir is not installed. If formatter_local set to true, there will be only 2 modules loaded on remote erlang node (Tracer.Utils and Tracer.Collector), which forward messages to the connected node. If formatter_local set to false, than formatter started on remote node and it load all modules from elixir application, because for formatting traces there should be loaded at least all Inspect modules.

  • :formatter - own formatter function, example because you try to trace different inspect function. Formatter is either a fun or tuple {module, function}.

  • :stack - stacktrace for the process call should be printed

  • :exported - only exported functions should be printed.

  • :no_return - no returns should be printed for a calls

Examples

iex> import Tracer # should be to simplify using of trace
nil

iex> trace :lists.seq
{:ok, 2}

iex> trace :lists.seq/2
{:ok, 1}

iex> trace :lists.seq(1, 10)
{:ok, 2}

iex> trace :lists.seq(a, b) when a < 10 and b > 25
{:ok, 2}

iex> trace :maps.get(:undefined, _), [:stack]
{:ok, 2}

iex> trace :maps.get/2, [limit: %{overall: 100, rate: 50, time: 50}]
{:ok, 2}