

API Reference — Exrun v0.2.1

 try {

 var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}');

 if (settings.theme === 'dark' ||

 ((settings.theme === 'system' || settings.theme == null) &&

 window.matchMedia('(prefers-color-scheme: dark)').matches)

 ) {

 document.body.classList.add('dark')

 }

 } catch (error) { }

 

Settings

API Reference Exrun v0.2.1

=======================================

[modules](#modules)

 Modules

-----------------------------

[Exrun](Exrun.html)

Generall functions for introspection of running elixir/erlang system

[IEx.Helpers.Tracer](IEx.Helpers.Tracer.html)

[Runner](Runner.html)

Generall functions for introspection of running elixir/erlang system

[Tracer](Tracer.html)

Main interface for tracing functionallity.

[Tracer.Collector](Tracer.Collector.html)

[Tracer.Formatter](Tracer.Formatter.html)

Tracer format and io functions.

[Tracer.Formatter.Base](Tracer.Formatter.Base.html)

[Tracer.Pattern](Tracer.Pattern.html)

Module for transformation of an Elixir AST to a pattern, that possible to use for tracing

[Tracer.Utils](Tracer.Utils.html)

Some utils functions and reimplemmenting some usefull functions, because if they traced, the

calls, made from tracer shouldn't traced too.





Exrun — Exrun v0.2.1

 try {

 var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}');

 if (settings.theme === 'dark' ||

 ((settings.theme === 'system' || settings.theme == null) &&

 window.matchMedia('(prefers-color-scheme: dark)').matches)

 ) {

 document.body.classList.add('dark')

 }

 } catch (error) { }

 

Settings

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/exrun.ex#L1 "View Source")

Exrun

(Exrun v0.2.1)

==============================================================================================================================

Generall functions for introspection of running elixir/erlang system





IEx.Helpers.Tracer — Exrun v0.2.1

 try {

 var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}');

 if (settings.theme === 'dark' ||

 ((settings.theme === 'system' || settings.theme == null) &&

 window.matchMedia('(prefers-color-scheme: dark)').matches)

 ) {

 document.body.classList.add('dark')

 }

 } catch (error) { }

 

Settings

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/iex.ex#L1 "View Source")

IEx.Helpers.Tracer

(Exrun v0.2.1)

================================================================================================================================================





Runner — Exrun v0.2.1

 try {

 var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}');

 if (settings.theme === 'dark' ||

 ((settings.theme === 'system' || settings.theme == null) &&

 window.matchMedia('(prefers-color-scheme: dark)').matches)

 ) {

 document.body.classList.add('dark')

 }

 } catch (error) { }

 

Settings

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/runner.ex#L1 "View Source")

Runner

(Exrun v0.2.1)

================================================================================================================================

Generall functions for introspection of running elixir/erlang system

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[allocators()](#allocators/0)

Allocators

[binary\_leak(n)](#binary_leak/1)

Check for binary memory leaks, using garbage collection.

[binary\_leak\_pid(pid)](#binary_leak_pid/1)

Check process for binary leak.

[format(bytes)](#format/1)

Helper function to transform bytes in appropriate format.

[memory(atom)](#memory/1)

Get allocator usage.

[process\_info(pid, attr)](#process_info/2)

Process info, which gives the identifier information back, like registered name, initial call and

current function, which helps to identify process.

[processes(n \\ 10)](#processes/1)

Find n processes, which use the most memory.

[scheduler\_usage(interval \\ 1000)](#scheduler_usage/1)

Scheduler usage based on scheduler wall time.

[sys\_mem()](#sys_mem/0)

System memory

[sys\_mem(memory)](#sys_mem/1)

[tabs(n \\ 10)](#tabs/1)

Find tabs

[util\_allocators()](#util_allocators/0)

Util allocators

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#allocators/0 "Link to this function")

allocators()

============

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/runner.ex#L126 "View Source")

Allocators

[Link to this function](#binary_leak/1 "Link to this function")

binary\_leak(n)

===============

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/runner.ex#L155 "View Source")

Check for binary memory leaks, using garbage collection.

[Link to this function](#binary_leak_pid/1 "Link to this function")

binary\_leak\_pid(pid)

======================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/runner.ex#L141 "View Source")

Check process for binary leak.

[Link to this function](#format/1 "Link to this function")

format(bytes)

=============

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/runner.ex#L16 "View Source")

Helper function to transform bytes in appropriate format.

[Link to this function](#memory/1 "Link to this function")

memory(atom)

============

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/runner.ex#L66 "View Source")

Get allocator usage.

[Link to this function](#process_info/2 "Link to this function")

process\_info(pid, attr)

========================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/runner.ex#L165 "View Source")

Process info, which gives the identifier information back, like registered name, initial call and

current function, which helps to identify process.

[Link to this function](#processes/1 "Link to this function")

processes(n \\ 10)

==================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/runner.ex#L24 "View Source")

Find n processes, which use the most memory.

[Link to this function](#scheduler_usage/1 "Link to this function")

scheduler\_usage(interval \\ 1000)

==================================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/runner.ex#L188 "View Source")

Scheduler usage based on scheduler wall time.

[Link to this function](#sys_mem/0 "Link to this function")

sys\_mem()

==========

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/runner.ex#L55 "View Source")

System memory

[Link to this function](#sys_mem/1 "Link to this function")

sys\_mem(memory)

================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/runner.ex#L59 "View Source")

[Link to this function](#tabs/1 "Link to this function")

tabs(n \\ 10)

=============

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/runner.ex#L44 "View Source")

Find tabs

[Link to this function](#util_allocators/0 "Link to this function")

util\_allocators()

==================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/runner.ex#L119 "View Source")

Util allocators





Tracer — Exrun v0.2.1

 try {

 var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}');

 if (settings.theme === 'dark' ||

 ((settings.theme === 'system' || settings.theme == null) &&

 window.matchMedia('(prefers-color-scheme: dark)').matches)

 ) {

 document.body.classList.add('dark')

 }

 } catch (error) { }

 

Settings

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer.ex#L1 "View Source")

Tracer

(Exrun v0.2.1)

================================================================================================================================

Main interface for tracing functionallity.

Usage:

```

use Tracer

trace Map.new()

```

Options:

* `: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: 250)

	+ `: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)Additionally limit can be specified as `limit: 5`, than it equivalent to `limit: %{overall: 5}`

* `: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, opts}`.

* `:format_opts` - any format options, which will be passed to [`inspect/2`](https://hexdocs.pm/elixir/Kernel.html#inspect/2). Per default structs

are disabled.

* `:io` - specify io process, which should handle io from a tracer or a tuple `{init_fun, handle_fun}`, which

handles initialization and io process. `init_fun` has zero arguments and should return `io`, which will be

passed to `handle_fun` together with a message.

* `:unlink` - tracer won't be stoped once a process started it terminates. (should be used for tracing into files

or using network)

* `:file` - specifies a file, where traces should be saved. Option `[file: "/tmp/trace.log"]` is a shortcut for

`[unlink: true, io: {{File, :open!, ["/tmp/trace.log", [:append]]}, {IO, :puts, []}}]`

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[clear\_traces(options \\ [])](#clear_traces/1)

Stop tracing

[ensure\_tracer(options)](#ensure_tracer/1)

Ensure tracer started

[get\_config(key)](#get_config/1)

[status(options \\ [])](#status/1)

Get status of tracer.

[trace(to\_trace, options \\ [])](#trace/2)

Options

-------

The following options are available

[trace\_off(options \\ [])](#trace_off/1)

Stop tracing

[trace\_run(compiled\_pattern, options \\ [])](#trace_run/2)

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#clear_traces/1 "Link to this function")

clear\_traces(options \\ [])

============================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer.ex#L240 "View Source")

Stop tracing

[Link to this function](#ensure_tracer/1 "Link to this function")

ensure\_tracer(options)

=======================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer.ex#L71 "View Source")

Ensure tracer started

[Link to this function](#get_config/1 "Link to this function")

get\_config(key)

================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer.ex#L223 "View Source")

[Link to this function](#status/1 "Link to this function")

status(options \\ [])

=====================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer.ex#L228 "View Source")

Get status of tracer.

[Link to this macro](#trace/2 "Link to this macro")

trace(to\_trace, options \\ [])

===============================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer.ex#L160 "View Source")

(macro)

[options](#trace/2-options)

 Options

-------------------------------------

The following options are available:

* `: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

* `:pid` - specify pid, you want to trace, otherwise all processes are traced

[examples](#trace/2-examples)

 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}

```

[Link to this function](#trace_off/1 "Link to this function")

trace\_off(options \\ [])

=========================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer.ex#L247 "View Source")

Stop tracing

[Link to this function](#trace_run/2 "Link to this function")

trace\_run(compiled\_pattern, options \\ [])

============================================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer.ex#L169 "View Source")





Tracer.Collector — Exrun v0.2.1

 try {

 var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}');

 if (settings.theme === 'dark' ||

 ((settings.theme === 'system' || settings.theme == null) &&

 window.matchMedia('(prefers-color-scheme: dark)').matches)

 ) {

 document.body.classList.add('dark')

 }

 } catch (error) { }

 

Settings

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L1 "View Source")

Tracer.Collector

(Exrun v0.2.1)

====================================================================================================================================================

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[clear\_traces(node)](#clear_traces/1)

[configure(node, io, limit, formatter)](#configure/4)

[ensure\_started(node, unlink?)](#ensure_started/2)

[handle\_call(arg1, state)](#handle_call/2)

[handle\_trace(trace, state)](#handle_trace/2)

[init(arg)](#init/1)

[loop(state)](#loop/1)

[start(node \\ node(), unlink?)](#start/2)

[status(node)](#status/1)

[stop(node)](#stop/1)

[stop(reason, map)](#stop/2)

[trace(node, processes, trace\_options)](#trace/3)

[trace\_and\_set(node, processes, trace\_options, pattern)](#trace_and_set/4)

[trace\_pattern(node, pattern)](#trace_pattern/2)

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#clear_traces/1 "Link to this function")

clear\_traces(node)

===================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L35 "View Source")

[Link to this function](#configure/4 "Link to this function")

configure(node, io, limit, formatter)

=====================================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L18 "View Source")

[Link to this function](#ensure_started/2 "Link to this function")

ensure\_started(node, unlink?)

==============================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L5 "View Source")

[Link to this function](#handle_call/2 "Link to this function")

handle\_call(arg1, state)

=========================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L73 "View Source")

[Link to this function](#handle_trace/2 "Link to this function")

handle\_trace(trace, state)

===========================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L132 "View Source")

[Link to this function](#init/1 "Link to this function")

init(arg)

=========

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L38 "View Source")

[Link to this function](#loop/1 "Link to this function")

loop(state)

===========

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L54 "View Source")

[Link to this function](#start/2 "Link to this function")

start(node \\ node(), unlink?)

==============================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L12 "View Source")

[Link to this function](#status/1 "Link to this function")

status(node)

============

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L34 "View Source")

[Link to this function](#stop/1 "Link to this function")

stop(node)

==========

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L36 "View Source")

[Link to this function](#stop/2 "Link to this function")

stop(reason, map)

=================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L110 "View Source")

[Link to this function](#trace/3 "Link to this function")

trace(node, processes, trace\_options)

======================================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L22 "View Source")

[Link to this function](#trace_and_set/4 "Link to this function")

trace\_and\_set(node, processes, trace\_options, pattern)

=========================================================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L30 "View Source")

[Link to this function](#trace_pattern/2 "Link to this function")

trace\_pattern(node, pattern)

=============================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L26 "View Source")





Tracer.Formatter — Exrun v0.2.1

 try {

 var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}');

 if (settings.theme === 'dark' ||

 ((settings.theme === 'system' || settings.theme == null) &&

 window.matchMedia('(prefers-color-scheme: dark)').matches)

 ) {

 document.body.classList.add('dark')

 }

 } catch (error) { }

 

Settings

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/formatter.ex#L1 "View Source")

Tracer.Formatter

(Exrun v0.2.1)

====================================================================================================================================================

Tracer format and io functions.

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[init(arg, formatter)](#init/2)

[start\_link(io, formatter)](#start_link/2)

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#init/2 "Link to this function")

init(arg, formatter)

====================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/formatter.ex#L12 "View Source")

[Link to this function](#start_link/2 "Link to this function")

start\_link(io, formatter)

==========================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/formatter.ex#L8 "View Source")





Tracer.Formatter.Base — Exrun v0.2.1

 try {

 var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}');

 if (settings.theme === 'dark' ||

 ((settings.theme === 'system' || settings.theme == null) &&

 window.matchMedia('(prefers-color-scheme: dark)').matches)

 ) {

 document.body.classList.add('dark')

 }

 } catch (error) { }

 

Settings

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/formatter/base.ex#L1 "View Source")

Tracer.Formatter.Base

(Exrun v0.2.1)

==============================================================================================================================================================

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[format\_time(now)](#format_time/1)

[format\_trace(msg, opts)](#format_trace/2)

Format trace message to a string.

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#format_time/1 "Link to this function")

format\_time(now)

=================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/formatter/base.ex#L88 "View Source")

[Link to this function](#format_trace/2 "Link to this function")

format\_trace(msg, opts)

========================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/formatter/base.ex#L5 "View Source")

Format trace message to a string.





Tracer.Pattern — Exrun v0.2.1

 try {

 var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}');

 if (settings.theme === 'dark' ||

 ((settings.theme === 'system' || settings.theme == null) &&

 window.matchMedia('(prefers-color-scheme: dark)').matches)

 ) {

 document.body.classList.add('dark')

 }

 } catch (error) { }

 

Settings

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/pattern.ex#L1 "View Source")

Tracer.Pattern

(Exrun v0.2.1)

================================================================================================================================================

Module for transformation of an Elixir AST to a pattern, that possible to use for tracing

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[compile(pattern, options \\ [])](#compile/2)

Compile pattern from elixir AST and options

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#compile/2 "Link to this function")

compile(pattern, options \\ [])

===============================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/pattern.ex#L9 "View Source")

Compile pattern from elixir AST and options





Tracer.Utils — Exrun v0.2.1

 try {

 var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}');

 if (settings.theme === 'dark' ||

 ((settings.theme === 'system' || settings.theme == null) &&

 window.matchMedia('(prefers-color-scheme: dark)').matches)

 ) {

 document.body.classList.add('dark')

 }

 } catch (error) { }

 

Settings

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/utils.ex#L1 "View Source")

Tracer.Utils

(Exrun v0.2.1)

============================================================================================================================================

Some utils functions and reimplemmenting some usefull functions, because if they traced, the

calls, made from tracer shouldn't traced too.

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[apply\_func(func, arguments \\ [])](#apply_func/2)

[call!(identifier, request, timeout \\ 10000)](#call!/3)

[call(identifier, request, timeout \\ 10000)](#call/3)

[load\_modules(node, module\_list \\ [Tracer.Utils])](#load_modules/2)

[rpc(node, module, function, args, timeout \\ 5000)](#rpc/5)

[rpc\_local(parent, tag, module, function, args)](#rpc_local/5)

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#apply_func/2 "Link to this function")

apply\_func(func, arguments \\ [])

==================================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/utils.ex#L85 "View Source")

[Link to this function](#call!/3 "Link to this function")

call!(identifier, request, timeout \\ 10000)

============================================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/utils.ex#L27 "View Source")

[Link to this function](#call/3 "Link to this function")

call(identifier, request, timeout \\ 10000)

===========================================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/utils.ex#L34 "View Source")

[Link to this function](#load_modules/2 "Link to this function")

load\_modules(node, module\_list \\ [Tracer.Utils])

===================================================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/utils.ex#L51 "View Source")

[Link to this function](#rpc/5 "Link to this function")

rpc(node, module, function, args, timeout \\ 5000)

==================================================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/utils.ex#L62 "View Source")

[Link to this function](#rpc_local/5 "Link to this function")

rpc\_local(parent, tag, module, function, args)

===============================================

[View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/utils.ex#L80 "View Source")

