tracex v0.1.0 Tracex.Trace View Source

Collection of helpers to extract data from compiler traces

Compiler traces encapsulate events happening in certain environment.

The module originating an event is considered an outbound module, the module on the receiving end is considered an inbound module.

For example, consider a trace emitted when module A imports a function from module B. A is denoted as outbound and B as inbound.

Traces of local function or marco calls naturally have the same module as both inbound and outbound.

Note that inbound/outbound notions translate directly to direction of the edge between the two modules involved in project's module dependency graph.

Link to this section Summary

Functions

Returns function name and arity formatted as function/arity for remote call traces

Returns location in code where a trace originates formatted as path:line

Returns true if given module is on the receiving end of the traced event

Returns trace's inbound module

Returns true if trace describes using given module via use GivenModule

Returns true if trace describes a module definition

Returns true if given module is originating the traced event

Returns trace's outbound module

Returns true if trace describes a remote function or macro call

Link to this section Types

Link to this type

env()

View Source
env() :: %{
  aliases: Macro.Env.aliases(),
  context: Macro.Env.context(),
  context_modules: Macro.Env.context_modules(),
  file: binary(),
  function: Macro.Env.name_arity() | nil,
  line: Macro.Env.line(),
  module: atom()
}

Link to this section Functions

Link to this function

event_func_and_arity(arg)

View Source
event_func_and_arity(t()) :: binary()

Returns function name and arity formatted as function/arity for remote call traces

Link to this function

event_location(arg)

View Source
event_location(t()) :: binary()

Returns location in code where a trace originates formatted as path:line

Elixir compiler does not always provide a precise line number of the code in question, but rather the line of where its execution environment is defined.

For example if an event originates in function's body, a line in which the function is defined is returned.

Link to this function

inbound?(trace, module)

View Source
inbound?(t(), atom()) :: boolean()

Returns true if given module is on the receiving end of the traced event

Link to this function

inbound_module(arg)

View Source
inbound_module(t()) :: atom()

Returns trace's inbound module

Link to this function

macro_usage?(arg, module)

View Source
macro_usage?(t(), atom()) :: boolean()

Returns true if trace describes using given module via use GivenModule

Link to this function

module_definition?(arg)

View Source
module_definition?(t()) :: boolean()

Returns true if trace describes a module definition

Link to this function

outbound?(trace, module)

View Source
outbound?(t(), atom()) :: boolean()

Returns true if given module is originating the traced event

Link to this function

outbound_module(arg)

View Source
outbound_module(t()) :: atom()

Returns trace's outbound module

Link to this function

remote_call?(arg)

View Source
remote_call?(t()) :: boolean()

Returns true if trace describes a remote function or macro call