diff options
author | Lukas Larsson <[email protected]> | 2016-04-15 15:10:55 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2016-04-15 15:10:55 +0200 |
commit | be7f01689e71cbc1896ea5c11fb0ebc6f7f6dd8a (patch) | |
tree | e7db1292fe6aa167408b7a7c93289fe2cca7e5c1 /lib/kernel/src/seq_trace.erl | |
parent | 67df3b3792857a2b4885c0acbeaa7f32f3594b0c (diff) | |
parent | cff38617986001e0a5f3f48de20acbeccceea978 (diff) | |
download | otp-be7f01689e71cbc1896ea5c11fb0ebc6f7f6dd8a.tar.gz otp-be7f01689e71cbc1896ea5c11fb0ebc6f7f6dd8a.tar.bz2 otp-be7f01689e71cbc1896ea5c11fb0ebc6f7f6dd8a.zip |
Merge branch 'lukas/erts/tracer-module-and-more/PR-1009/OTP-10268'
* lukas/erts/tracer-module-and-more/PR-1009/OTP-10268: (26 commits)
erts: Don't trace on link events when port is dead
erts: more logging in trace_bif_SUITE trace_bif_return
erts: Make trace_delivered go via sys msg dispatcher again
erts: Add comment about future trace optimizations
erts: Optimize tracer reload test
erts: Document erlang:match_spec_test/3
runtime_tools: Make dbg work with erl_tracer modules
runtime_rools: Allow new timestamp trace flags
runtime_tools: Lots of dbg docs updates
erts: Deallocate heap fragments from trace nif calls
eprof: Fix tests after tracer module incompatabilities
fprof: update to work with new spawned trace event
erts: Add 'spawned' trace event to 'procs' trace flag
erts: send and receive no longer need status lock
erts: Do 'unregister' as "self-tracing"
erts: Silence harmless valgrind warning in dec_term
erts: Fix end_per_testcase crash in local_trace_SUITE
observer: Update ttb to work with tracing on ports
runtime_tools: Update dbg to work with tracing on ports
erts: Add tracing examples in match spec docs
...
Diffstat (limited to 'lib/kernel/src/seq_trace.erl')
-rw-r--r-- | lib/kernel/src/seq_trace.erl | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/kernel/src/seq_trace.erl b/lib/kernel/src/seq_trace.erl index 01ac024c88..cc0c10909b 100644 --- a/lib/kernel/src/seq_trace.erl +++ b/lib/kernel/src/seq_trace.erl @@ -106,14 +106,24 @@ reset_trace() -> %% reset_trace(Pid) -> % this might be a useful function too --type tracer() :: (Pid :: pid()) | port() | 'false'. +-type tracer() :: (Pid :: pid()) | port() | + (TracerModule :: {module(), term()}) | + 'false'. -spec set_system_tracer(Tracer) -> OldTracer when Tracer :: tracer(), OldTracer :: tracer(). -set_system_tracer(Pid) -> - erlang:system_flag(sequential_tracer, Pid). +set_system_tracer({Module, State} = Tracer) -> + case erlang:module_loaded(Module) of + false -> + Module:enabled(trace_status, erlang:self(), State); + true -> + ok + end, + erlang:system_flag(sequential_tracer, Tracer); +set_system_tracer(Tracer) -> + erlang:system_flag(sequential_tracer, Tracer). -spec get_system_tracer() -> Tracer when Tracer :: tracer(). |