diff options
author | Duncan Coutts <duncan@well-typed.com> | 2012-10-15 00:52:32 +0100 |
---|---|---|
committer | Duncan Coutts <duncan@well-typed.com> | 2012-10-15 12:28:29 +0100 |
commit | a609027da31c7c9103d8b9741ba3fc6807b7b7b9 (patch) | |
tree | d0e5340b10ef2d2e3935c3d682e3b35e4737d1ac /rts/Trace.c | |
parent | 8af2d940c786136a29a061fa9542e39f65e6d6fb (diff) | |
download | haskell-a609027da31c7c9103d8b9741ba3fc6807b7b7b9.tar.gz |
Add a new traceMarker# primop for use in profiling output
In time-based profiling visualisations (e.g. heap profiles and ThreadScope)
it would be useful to be able to mark particular points in the execution and
have those points in time marked in the visualisation.
The traceMarker# primop currently emits an event into the eventlog. In
principle it could be extended to do something in the heap profiling too.
Diffstat (limited to 'rts/Trace.c')
-rw-r--r-- | rts/Trace.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/rts/Trace.c b/rts/Trace.c index 7a08c0f817..9da2115e2e 100644 --- a/rts/Trace.c +++ b/rts/Trace.c @@ -708,6 +708,28 @@ void traceUserMsg(Capability *cap, char *msg) traceFormatUserMsg(cap, "%s", msg); } +void traceUserMarker(Capability *cap, char *markername) +{ + /* Note: traceUserMarker is special since it has no wrapper (it's called + from cmm code), so we check eventlog_enabled and TRACE_user here. + */ +#ifdef DEBUG + if (RtsFlags.TraceFlags.tracing == TRACE_STDERR && TRACE_user) { + ACQUIRE_LOCK(&trace_utx); + tracePreface(); + debugBelch("cap %d: User marker: %s\n", cap->no, markername); + RELEASE_LOCK(&trace_utx); + } else +#endif + { + if (eventlog_enabled && TRACE_user) { + postUserMarker(cap, markername); + } + } + dtraceUserMarker(cap->no, markername); +} + + void traceThreadLabel_(Capability *cap, StgTSO *tso, char *label) |