X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FTrace.c;h=53fc25a249fa1fd65bcfca90c20a48474b2bd95e;hb=209e093599d0d4db5487d124895d817c55b7c052;hp=a1da9911a717d20484041d9408a107f09ee6a4e9;hpb=015d3d46b6de2f95386a515a7d166d996a0416db;p=ghc-hetmet.git diff --git a/rts/Trace.c b/rts/Trace.c index a1da991..53fc25a 100644 --- a/rts/Trace.c +++ b/rts/Trace.c @@ -106,6 +106,14 @@ void freeTracing (void) } } +void resetTracing (void) +{ + if (eventlog_enabled) { + abortEventLogging(); // abort eventlog inherited from parent + initEventLogging(); // child starts its own eventlog + } +} + /* --------------------------------------------------------------------------- Emitting trace messages/events --------------------------------------------------------------------------- */ @@ -204,7 +212,7 @@ static void traceSchedEvent_stderr (Capability *cap, EventTypeNum tag, debugBelch("cap %d: GC done\n", cap->no); break; default: - debugBelch("cap %2d: thread %lu: event %d\n\n", + debugBelch("cap %d: thread %lu: event %d\n\n", cap->no, (lnat)tso->id, tag); break; } @@ -244,7 +252,7 @@ static void traceCap_stderr(Capability *cap, char *msg, va_list ap) ACQUIRE_LOCK(&trace_utx); tracePreface(); - debugBelch("cap %2d: ", cap->no); + debugBelch("cap %d: ", cap->no); vdebugBelch(msg,ap); debugBelch("\n"); @@ -299,21 +307,29 @@ void trace_(char *msg, ...) va_end(ap); } -void traceUserMsg(Capability *cap, char *msg) +static void traceFormatUserMsg(Capability *cap, char *msg, ...) { + va_list ap; + va_start(ap,msg); + #ifdef DEBUG if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) { - traceCap_stderr(cap, msg, NULL); + traceCap_stderr(cap, msg, ap); } else #endif { if (eventlog_enabled) { - postUserMsg(cap, msg); + postUserMsg(cap, msg, ap); } } dtraceUserMsg(cap->no, msg); } +void traceUserMsg(Capability *cap, char *msg) +{ + traceFormatUserMsg(cap, "%s", msg); +} + void traceThreadStatus_ (StgTSO *tso USED_IF_DEBUG) { #ifdef DEBUG