Information Technology Reference
In-Depth Information
For merging the traces, there are a number of options provided. The simplest
of them is to write every trace to a file in the order that it was generated. The
merge functionality can also be used to conduct property checking or profiling
the system. Moreover, it is possible to merge the same data multiple times with
different specifications, making it possible to check for various properties with
every merge.
Onviso Example. The following example demonstrates one of the simplest
use-cases of Onviso. The user specifies the patterns which can be either local
or exported functions of any module on any of the following nodes. A pattern
is specified as {Module, Format, Arguments, Match_specification} .Obvi-
ously any number of patterns can be specified.
1> onviso:trace([{heart, send_heart_beat, '_', []},
{io, format, '_', return}],
['server@linux', 'client@linux'],
{all, [call]}).
{ok, 1}
2> onviso:merge(1, void, void, shell).
...
{server@linux, Pid, call, {io,format,["~p,~p~",[jacques, derida]]},
{1250,585321,791722}}
...
{ok, 15}
As seen in the second trace pattern, defined above, it is possible to use short-cuts
for the most common match specification actions (like return).
If desired one can, of course, write custom functions for merging. The following
example illustrates writing trace data into a file (as this is a common use case,
there is another shortcut provided so that it is not necessary to write the funs
by hand).
3> BeginFun = fun(_InitData) ->
case file:open("output.txt", [write]) of
{ok, FD} ->
{ok, FD};
{error, Reason} ->
{error, Reason}
end
end,
#Fun<erl_eval.6.13229925>
4> WorkFun = fun(Node, Trace, _, FD) ->
io:format(FD, "~p >> ~p~n", [Node, Trace]),
{ok, FD}
end,
#Fun<erl_eval.4.105156089>
Search WWH ::




Custom Search