|
|
@ -18,14 +18,14 @@ groups() -> |
|
|
|
|
|
|
|
app(Config) -> |
|
|
|
doc("Trace a specific application."), |
|
|
|
eTpf:trace({app, stdlib}, lg_file_tracer, config(priv_dir, Config) ++ "/app.lz4"), |
|
|
|
eTpf:trace({app, stdlib}, tpFileTracer, config(priv_dir, Config) ++ "/app.lz4"), |
|
|
|
lists:seq(1, 10), |
|
|
|
eTpf:stop(), |
|
|
|
do_ensure_decompress(config(priv_dir, Config) ++ "/app.lz4"). |
|
|
|
|
|
|
|
callback(Config) -> |
|
|
|
doc("Trace using patterns from a callback function."), |
|
|
|
eTpf:trace({callback, ?MODULE, do_callback}, lg_file_tracer, |
|
|
|
eTpf:trace({callback, ?MODULE, do_callback}, tpFileTracer, |
|
|
|
config(priv_dir, Config) ++ "/callback.lz4"), |
|
|
|
lists:seq(1, 10), |
|
|
|
eTpf:stop(), |
|
|
@ -37,12 +37,12 @@ do_callback() -> |
|
|
|
callgrind_running(Config) -> |
|
|
|
doc("Save events to files on disk then build callgrind files."), |
|
|
|
PrivDir = config(priv_dir, Config), |
|
|
|
eTpf:trace([{scope, [self()]}, ?MODULE, {app, stdlib}], lg_file_tracer, |
|
|
|
eTpf:trace([{scope, [self()]}, ?MODULE, {app, stdlib}], tpFileTracer, |
|
|
|
PrivDir ++ "/callgrind_running.lz4", |
|
|
|
#{mode => profile, running => true}), |
|
|
|
do_callgrind_running(), |
|
|
|
eTpf:stop(), |
|
|
|
lg_callgrind:profile_many( |
|
|
|
tpCallgrind:profile_many( |
|
|
|
PrivDir ++ "/callgrind_running.lz4.*", |
|
|
|
PrivDir ++ "/callgrind_running.out", |
|
|
|
#{running => true}), |
|
|
@ -75,12 +75,12 @@ callgrind_running_cycle(Config) -> |
|
|
|
doc("Save events to files on disk then build callgrind files. " |
|
|
|
"Create a recursive cycle using two functions calling each other."), |
|
|
|
PrivDir = config(priv_dir, Config), |
|
|
|
eTpf:trace([{scope, [self()]}, ?MODULE, {app, stdlib}], lg_file_tracer, |
|
|
|
eTpf:trace([{scope, [self()]}, ?MODULE, {app, stdlib}], tpFileTracer, |
|
|
|
PrivDir ++ "/callgrind_running_cycle.lz4", |
|
|
|
#{mode => profile, running => true}), |
|
|
|
do_callgrind_running_cycle(), |
|
|
|
eTpf:stop(), |
|
|
|
lg_callgrind:profile_many( |
|
|
|
tpCallgrind:profile_many( |
|
|
|
PrivDir ++ "/callgrind_running_cycle.lz4.*", |
|
|
|
PrivDir ++ "/callgrind_running_cycle.out", |
|
|
|
#{running => true}), |
|
|
@ -126,7 +126,7 @@ do_callgrind_running_cycle2(Ref) -> |
|
|
|
|
|
|
|
file_tracer(Config) -> |
|
|
|
doc("Save events to files on disk."), |
|
|
|
eTpf:trace(lists, lg_file_tracer, config(priv_dir, Config) ++ "/file_tracer.lz4"), |
|
|
|
eTpf:trace(lists, tpFileTracer, config(priv_dir, Config) ++ "/file_tracer.lz4"), |
|
|
|
lists:seq(1, 10), |
|
|
|
eTpf:stop(), |
|
|
|
do_ensure_decompress(config(priv_dir, Config) ++ "/file_tracer.lz4"). |
|
|
@ -134,7 +134,7 @@ file_tracer(Config) -> |
|
|
|
file_tracer_rotation(Config) -> |
|
|
|
doc("Save events to files on disk; rotate the files if they get too big."), |
|
|
|
Prefix = config(priv_dir, Config) ++ "/file_tracer.lz4", |
|
|
|
eTpf:trace(lists, lg_file_tracer, #{ |
|
|
|
eTpf:trace(lists, tpFileTracer, #{ |
|
|
|
filename_prefix => Prefix, |
|
|
|
max_size => 100, %% Intentionally low. |
|
|
|
events_per_frame => 10 %% Needed to trigger the rotation, default is too high. |
|
|
@ -151,14 +151,14 @@ file_tracer_rotation(Config) -> |
|
|
|
|
|
|
|
mod(Config) -> |
|
|
|
doc("Trace a specific module."), |
|
|
|
eTpf:trace(lists, lg_file_tracer, config(priv_dir, Config) ++ "/mod.lz4"), |
|
|
|
eTpf:trace(lists, tpFileTracer, config(priv_dir, Config) ++ "/mod.lz4"), |
|
|
|
lists:seq(1, 10), |
|
|
|
eTpf:stop(), |
|
|
|
do_ensure_decompress(config(priv_dir, Config) ++ "/mod.lz4"). |
|
|
|
|
|
|
|
profile_mode(Config) -> |
|
|
|
doc("Trace a specific module in profile mode."), |
|
|
|
eTpf:trace(lists, lg_file_tracer, config(priv_dir, Config) ++ "/profile_mode.lz4", |
|
|
|
eTpf:trace(lists, tpFileTracer, config(priv_dir, Config) ++ "/profile_mode.lz4", |
|
|
|
#{mode => profile}), |
|
|
|
lists:seq(1, 10), |
|
|
|
eTpf:stop(), |
|
|
@ -175,7 +175,7 @@ raw_console_tracer(_) -> |
|
|
|
|
|
|
|
running_true(Config) -> |
|
|
|
doc("Trace a specific module with running option enabled."), |
|
|
|
eTpf:trace(lists, lg_file_tracer, config(priv_dir, Config) ++ "/running_true.lz4", |
|
|
|
eTpf:trace(lists, tpFileTracer, config(priv_dir, Config) ++ "/running_true.lz4", |
|
|
|
#{running => true}), |
|
|
|
lists:seq(1, 10), |
|
|
|
eTpf:stop(), |
|
|
@ -183,7 +183,7 @@ running_true(Config) -> |
|
|
|
|
|
|
|
send_true(Config) -> |
|
|
|
doc("Trace a specific module with send option enabled."), |
|
|
|
eTpf:trace(lists, lg_file_tracer, config(priv_dir, Config) ++ "/send_true.lz4", |
|
|
|
eTpf:trace(lists, tpFileTracer, config(priv_dir, Config) ++ "/send_true.lz4", |
|
|
|
#{send => true}), |
|
|
|
Self = self(), |
|
|
|
%% Send a message to and from an existing process. |
|
|
@ -204,7 +204,7 @@ send_true(Config) -> |
|
|
|
socket_tracer(_) -> |
|
|
|
doc("Send events to a socket."), |
|
|
|
Port = 61234, |
|
|
|
eTpf:trace(lists, lg_socket_tracer, Port, #{pool_size => 1}), |
|
|
|
eTpf:trace(lists, tpSocketTracer, Port, #{pool_size => 1}), |
|
|
|
{ok, Socket} = gen_tcp:connect("localhost", Port, |
|
|
|
[binary, {packet, 2}, {active, true}]), |
|
|
|
lists:seq(1, 10), |
|
|
@ -214,13 +214,13 @@ socket_tracer(_) -> |
|
|
|
socket_tracer_client(Config) -> |
|
|
|
doc("Send events to a socket client."), |
|
|
|
Port = 61234, |
|
|
|
eTpf:trace(lists, lg_socket_tracer, Port, #{pool_size => 1}), |
|
|
|
eTpf:trace(lists, tpSocketTracer, Port, #{pool_size => 1}), |
|
|
|
BaseFilename = config(priv_dir, Config) ++ "/socket_tracer_client.lz4", |
|
|
|
{ok, Pid} = lg_socket_client:start_link(Port, BaseFilename), |
|
|
|
{ok, Pid} = tpSocketClient:start_link(Port, BaseFilename), |
|
|
|
timer:sleep(1000), |
|
|
|
lists:seq(1, 10), |
|
|
|
eTpf:stop(), |
|
|
|
lg_socket_client:stop(Pid), |
|
|
|
tpSocketClient:stop(Pid), |
|
|
|
{ok, File} = file:read_file(BaseFilename ++ ".0"), |
|
|
|
_ = lz4f:decompress(File), |
|
|
|
true = filelib:file_size(BaseFilename ++ ".0") > 0, |
|
|
@ -229,7 +229,7 @@ socket_tracer_client(Config) -> |
|
|
|
socket_tracer_many(_) -> |
|
|
|
doc("Send events to many sockets."), |
|
|
|
Port = 61234, |
|
|
|
eTpf:trace(lists, lg_socket_tracer, Port, #{pool_size => 5}), |
|
|
|
eTpf:trace(lists, tpSocketTracer, Port, #{pool_size => 5}), |
|
|
|
{ok, _} = gen_tcp:connect("localhost", Port, []), |
|
|
|
{ok, _} = gen_tcp:connect("localhost", Port + 1, []), |
|
|
|
{ok, _} = gen_tcp:connect("localhost", Port + 2, []), |
|
|
@ -241,7 +241,7 @@ socket_tracer_many(_) -> |
|
|
|
socket_tracer_reconnect(_) -> |
|
|
|
doc("Confirm we can reconnect to the tracer."), |
|
|
|
Port = 61234, |
|
|
|
eTpf:trace(lists, lg_socket_tracer, Port, #{pool_size => 1}), |
|
|
|
eTpf:trace(lists, tpSocketTracer, Port, #{pool_size => 1}), |
|
|
|
{ok, Socket0} = gen_tcp:connect("localhost", Port, |
|
|
|
[binary, {packet, 2}, {active, true}]), |
|
|
|
ok = gen_tcp:close(Socket0), |
|
|
@ -267,7 +267,7 @@ stop_while_trace_is_running(Config) -> |
|
|
|
doc("Stop tracing while events are still coming in."), |
|
|
|
Self = self(), |
|
|
|
Pid = spawn_link(fun() -> Self ! {self(), continue}, lists:seq(1, 10000000) end), |
|
|
|
eTpf:trace([{scope, [Pid]}, lists], lg_file_tracer, |
|
|
|
eTpf:trace([{scope, [Pid]}, lists], tpFileTracer, |
|
|
|
config(priv_dir, Config) ++ "/stop_while_trace_is_running.lz4"), |
|
|
|
receive {Pid, continue} -> ok after 100 -> error(timeout) end, |
|
|
|
eTpf:stop(), |
|
|
|