X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FTrace.c;h=81a2eb2c243d88dd7baf5e8f1c9c95bc02ba2af9;hb=c5f93af1c663ab68f3b18f6a8c3264165a1c8883;hp=8991033213312d6fa90d939f333dc0a5c57af8f3;hpb=3db8a9be9f89fe76e0a27f24ab02977974b6613f;p=ghc-hetmet.git diff --git a/rts/Trace.c b/rts/Trace.c index 8991033..81a2eb2 100644 --- a/rts/Trace.c +++ b/rts/Trace.c @@ -63,7 +63,6 @@ void initTracing (void) class = RtsFlags.DebugFlags.name ? 1 : 0; DEBUG_FLAG(scheduler, DEBUG_sched); - DEBUG_FLAG(scheduler, TRACE_sched); // -Ds enabled all sched events DEBUG_FLAG(interpreter, DEBUG_interp); DEBUG_FLAG(weak, DEBUG_weak); @@ -80,29 +79,12 @@ void initTracing (void) DEBUG_FLAG(sparks, DEBUG_sparks); #endif -#define TRACE_FLAG(name, class) \ - class = RtsFlags.TraceFlags.name ? 1 : 0; + // -Ds turns on scheduler tracing too + TRACE_sched = + RtsFlags.TraceFlags.scheduler || + RtsFlags.DebugFlags.scheduler; - TRACE_FLAG(scheduler, TRACE_sched); - - eventlog_enabled = !RtsFlags.TraceFlags.trace_stderr && ( - TRACE_sched -#ifdef DEBUG - | DEBUG_sched - | DEBUG_interp - | DEBUG_weak - | DEBUG_gccafs - | DEBUG_gc - | DEBUG_block_alloc - | DEBUG_sanity - | DEBUG_stable - | DEBUG_stm - | DEBUG_prof - | DEBUG_linker - | DEBUG_squeeze - | DEBUG_hpc -#endif - ); + eventlog_enabled = RtsFlags.TraceFlags.tracing == TRACE_EVENTLOG; if (eventlog_enabled) { initEventLogging(); @@ -225,7 +207,7 @@ void traceSchedEvent_ (Capability *cap, EventTypeNum tag, StgTSO *tso, StgWord64 other) { #ifdef DEBUG - if (RtsFlags.TraceFlags.trace_stderr) { + if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) { traceSchedEvent_stderr(cap, tag, tso, other); } else #endif @@ -254,7 +236,7 @@ void traceCap_(Capability *cap, char *msg, ...) va_start(ap,msg); #ifdef DEBUG - if (RtsFlags.TraceFlags.trace_stderr) { + if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) { traceCap_stderr(cap, msg, ap); } else #endif @@ -284,7 +266,7 @@ void trace_(char *msg, ...) va_start(ap,msg); #ifdef DEBUG - if (RtsFlags.TraceFlags.trace_stderr) { + if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) { trace_stderr(msg, ap); } else #endif @@ -295,10 +277,24 @@ void trace_(char *msg, ...) va_end(ap); } +void traceUserMsg(Capability *cap, char *msg) +{ +#ifdef DEBUG + if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) { + traceCap_stderr(cap, msg, NULL); + } else +#endif + { + if (eventlog_enabled) { + postUserMsg(cap, msg); + } + } +} + void traceThreadStatus_ (StgTSO *tso USED_IF_DEBUG) { #ifdef DEBUG - if (RtsFlags.TraceFlags.trace_stderr) { + if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) { printThreadStatus(tso); } else #endif