# Module trace_mpath

- Description
- Data Types
- Function Index
- Function Details

Trace what a message triggers in the system by tracing all generated subsequent messages.

Copyright © 2012-2016 Zuse Institute Berlin

Version: $Id$

Behaviours: `gen_component`.

Authors: Florian Schintke (`schintke@zib.de`).

## Description

Trace what a message triggers in the system by tracing all generated subsequent messages.

## Data Types

### anypid()

    anypid() = pid() | comm:mypid()

### erlang_timestamp()

    erlang_timestamp() =
        {MegaSecs :: non_neg_integer(),
         Secs :: 0..999999,
         MicroSecs :: 0..999999}

### filter_fun()

    filter_fun() = fun((trace_event()) -> boolean())

### gc_mpath_msg()

    gc_mpath_msg() =
        {'$gen_component',
         trace_mpath,
         passed_state(),
         Source :: anypid(),
         Dest :: anypid(),
         comm:message()}

### info_event()

    info_event() =
        {log_info, time(), trace_id(), pidinfo(), comm:message()}

### logger()

    logger() =
        io_format |
        {log_collector, comm:mypid()} |
        {proto_sched, comm:mypid()}

### msg_map_fun()

    msg_map_fun() =
        fun((comm:message(),
             Source :: pid() | comm:mypid(),
             Dest :: pid() | comm:mypid()) ->
                comm:message())

### options()

    options() =
        [{logger, logger() | comm:mypid()} |
         {map_fun, msg_map_fun()} |
         {filter_fun, filter_fun()}]

### passed_state()

    passed_state() = passed_state1() | {trace_id(), logger()}

### passed_state1()

    passed_state1() =
        {trace_id(), logger(), msg_map_fun(), filter_fun()}

### pidinfo()

    pidinfo() =
        {comm:mypid(),
         {pid_groups:groupname(), pid_groups:pidname()} |
         no_pid_name |
         non_local_pid_name_unknown}

### recv_event()

    recv_event() =
        {log_recv,
         time(),
         trace_id(),
         Source :: pidinfo(),
         Dest :: pidinfo(),
         comm:message()}

### send_event()

    send_event() =
        {log_send,
         time(),
         trace_id(),
         Source :: pidinfo(),
         Dest :: pidinfo(),
         comm:message(),
         local | global}

### state()

    state() = [{trace_id(), trace()}]

### time()

    time() = erlang_timestamp() | non_neg_integer()

### trace()

    trace() = [trace_event()]

### trace_event()

    trace_event() = send_event() | info_event() | recv_event()

### trace_id()

    trace_id() = atom()

## Function Index

cleanup/0 |
cleanup/1 |
clear_infection/0 |
epidemic_reply_msg/4 |
get_msg_tag/1 | Gets the message tag of the given message.
get_trace/0 |
get_trace/1 |
get_trace/2 |
get_trace_raw/1 |
get_trace_raw/2 |
infected/0 |
init/1 |
log_info/2 |
log_info/3 |
log_recv/4 |
log_send/6 |
normalize_pidinfo/1 |
on/2 |
restore_infection/0 |
send_histogram/1 |
start/0 |
start/1 |
start/2 |
start_gen_component/5 |
start_link/1 |
stop/0 |
thread_yield/0 |
time_delta/1 |
to_texfile/2 | Write the trace to a LaTeX file (20 microseconds in the trace are 1 cm in the plot).
to_texfile/3 | Write the trace to a LaTeX file (ScaleX microseconds in the trace are 1 cm in the plot).
to_texfile_no_time/2 | Write the trace to a LaTeX file (20 microseconds in the trace are 1 cm in the plot).
to_texfile_no_time/3 | Write the trace to a LaTeX file (ScaleX microseconds in the trace are 1 cm in the plot).

## Function Details

### start_gen_component/5

    start_gen_component(Module :: module(),
                        Handler :: gen_component:handler(),
                        Args :: term(),
                        Options :: [gen_component:option()],
                        Self :: pid()) ->
                           no_return() | ok

### start/0

    start() -> ok

### start/1

    start(TraceId :: trace_id() | passed_state()) -> ok

### start/2

    start(TraceId :: trace_id(),
          Options :: logger() | comm:mypid() | options()) ->
             ok

### stop/0

    stop() -> ok

### infected/0

    infected() -> boolean()

### clear_infection/0

    clear_infection() -> ok

### restore_infection/0

    restore_infection() -> ok

### get_trace/0

    get_trace() -> trace()

### get_trace/1

    get_trace(TraceId :: trace_id()) -> trace()

### get_trace/2

    get_trace(TraceId :: trace_id(), Option :: cleanup | none) ->
                 trace()

### get_trace_raw/1

    get_trace_raw(TraceId :: trace_id()) -> trace()

### get_trace_raw/2

    get_trace_raw(TraceId :: trace_id(), Option :: cleanup | none) ->
                     trace()

### cleanup/0

    cleanup() -> ok

### cleanup/1

    cleanup(TraceId :: trace_id()) -> ok

### thread_yield/0

    thread_yield() -> ok

### send_histogram/1

    send_histogram(Trace :: trace()) -> list()

### time_delta/1

    time_delta(Trace :: trace()) -> trace()

### to_texfile/2

    to_texfile(Trace :: trace(), Filename :: file:name()) ->
                  ok | {error, file:posix() | badarg | terminated}

Write the trace to a LaTeX file (20 microseconds in the trace are 1 cm in the plot).

### to_texfile/3

    to_texfile(Trace :: trace(),
               Filename :: file:name(),
               ScaleX :: pos_integer()) ->
                  ok | {error, file:posix() | badarg | terminated}

Write the trace to a LaTeX file (ScaleX microseconds in the trace are 1 cm in the plot).

### to_texfile_no_time/2

    to_texfile_no_time(Trace :: trace(), Filename :: file:name()) ->
                          ok |
                          {error, file:posix() | badarg | terminated}

Write the trace to a LaTeX file (20 microseconds in the trace are 1 cm in the plot). The representation will not have a time representation but rather only show successive messages.

### to_texfile_no_time/3

    to_texfile_no_time(Trace :: trace(),
                       Filename :: file:name(),
                       ScaleX :: pos_integer()) ->
                          ok |
                          {error, file:posix() | badarg | terminated}

Write the trace to a LaTeX file (ScaleX microseconds in the trace are 1 cm in the plot). The representation will not have a time representation but rather only show successive messages.

### get_msg_tag/1

    get_msg_tag(Msg :: comm:message()) -> atom() | {atom(), atom()}

Gets the message tag of the given message. Special dht_node messages of embedded processes get translated into a tuple of two message tags.

### epidemic_reply_msg/4

    epidemic_reply_msg(PState :: passed_state(),
                       FromPid :: anypid(),
                       ToPid :: anypid(),
                       Msg :: comm:message()) ->
                          gc_mpath_msg()

### log_send/6

    log_send(PState :: passed_state(),
             FromPid :: anypid(),
             ToPid :: anypid(),
             Msg :: comm:message(),
             LocalOrGlobal :: local | global | local_after,
             SendOptions :: comm:send_options()) ->
                DeliverAlsoDirectly :: boolean()

### log_info/2

    log_info(FromPid :: anypid(), Info :: comm:message()) -> ok

### log_info/3

    log_info(PState :: passed_state(),
             FromPid :: anypid(),
             Info :: comm:message()) ->
                ok

### log_recv/4

    log_recv(PState :: passed_state(),
             FromPid :: anypid(),
             ToPid :: anypid(),
             Msg :: comm:message()) ->
                ok

### normalize_pidinfo/1

    normalize_pidinfo(Pid :: anypid() | pidinfo()) -> pidinfo()

### start_link/1

    start_link(ServiceGroup :: pid_groups:groupname()) -> {ok, pid()}

### init/1

    init(Arg :: any()) -> state()

### on/2

    on(Msg :: trace_event() | comm:message(), State :: state()) ->
          state()

Generated by EDoc, Feb 29 2016, 16:12:16.