Types
Result = {ok, ActivatedNodes} | {error,Reason}
Nodes = atom() | [atom()] | all | existing | new
Opts = Opt | [Opt]
Opt = {file,Client} | {handler, FormatHandler} | {process_info,PI} | shell | {shell, ShellSpec} | {timer, TimerSpec} | {overload_check, {MSec, Module, Function}} | {flush, MSec} | resume | {resume, FetchTimeout} | {queue_size, QueueSize}
TimerSpec = MSec | {MSec, StopOpts}
MSec = FetchTimeout = integer()
Module = Function = atom()
StopOpts = see stop/2
Client = File | {local, File}
File = Filename | Wrap
Filename = string()
Wrap = {wrap,Filename} | {wrap,Filename,Size,Count}
FormatHandler = See format/2
PI = true | false
ShellSpec = true | false | only
QueueSize = non_neg_integer()
Starts a file trace port on all specified nodes and points the system tracer for sequential tracing to the same port.
Options:
Filename The specified Filename is prefixed with the node name. Default Filename is ttb.
File={wrap,Filename,Size,Count} Can be used if the size of the trace logs must be limited. Default values are Size=128*1024 and Count=8.
Client When tracing diskless nodes, ttb must be started from an external "trace control node" with disk access, and Client must be {local, File}. All trace information is then sent to the trace control node where it is written to file.
queue_size When tracing to shell or {local,File}, an ip trace driver is used internally. The ip trace driver has a queue of maximum QueueSize messages waiting to be delivered. If the driver cannot deliver messages as fast as they are produced, the queue size might be exceeded and messages are dropped. This parameter is optional, and is only useful if many {drop,N} trace messages are received by the trace handler. It has no meaning if shell or {local,File} is not used. See dbg:trace_port/2 for more information about the ip trace driver.
process_info Indicates if process information is to be collected. If PI = true (which is default), each process identifier Pid is replaced by a tuple {Pid,ProcessInfo,Node}, where ProcessInfo is the registered process name, its globally registered name, or its initial function. To turn off this functionality, set PI = false.
{shell, ShellSpec} Indicates that trace messages are to be printed on the console as they are received by the tracing process. This implies trace client {local, File}. If ShellSpec is only (instead of true), no trace logs are stored.
shell Shortcut for {shell, true}.
timer Indicates that the trace is to be automatically stopped after MSec milliseconds. StopOpts are passed to command ttb:stop/2 if specified (default is []). Notice that the timing is approximate, as delays related to network communication are always present. The timer starts after ttb:p/2 is issued, so you can set up your trace patterns before.
overload_check -
Allows to enable overload checking on the nodes under trace. Module:Function(check) is performed each MSec millisecond. If the check returns true, the tracing is disabled on a specified node.
Module:Function must be able to handle at least three atoms: init, check, and stop. init and stop allows you to initialize and clean up the check environment.
When a node gets overloaded, it is not possible to issue ttb:p/2 or any command from the ttb:tp/2,3,4 family, as it would lead to inconsistent tracing state (different trace specifications on different nodes).
flush Periodically flushes all file trace port clients (see dbg:flush_trace_port/1). When enabled, the buffers are freed each MSec millisecond. This option is not allowed with {file, {local, File}} tracing.
{resume, FetchTimeout} -
Enables the autoresume feature. When enabled, remote nodes try to reconnect to the controlling node if they are restarted. The feature requires application Runtime_Tools to be started (so it has to be present in the .boot scripts if the traced nodes run with embedded Erlang). If this is not possible, resume can be performed manually by starting Runtime_Tools remotely using rpc:call/4.
ttb tries to fetch all logs from a reconnecting node before reinitializing the trace. This must finish within FetchTimeout milliseconds or is aborted.
By default, autostart information is stored in a file named ttb_autostart.bin on each node. If this is not desired (for example, on diskless nodes), a custom module handling autostart information storage and retrieval can be provided by specifying environment variable ttb_autostart_module for the application Runtime_Tools. The module must respond to the following API:
write_config(Data) -> ok Stores the provided data for further retrieval. It is important to realize that the data storage used must not be affected by the node crash.
read_config() -> {ok, Data} | {error, Error} Retrieves configuration stored with write_config(Data).
delete_config() -> ok -
Deletes configuration stored with write_config(Data). Notice that after this call any subsequent calls to read_config must return {error, Error}.
resume implies the default FetchTimeout, which is 10 seconds