diff options
Diffstat (limited to 'rts/Trace.c')
-rw-r--r-- | rts/Trace.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/rts/Trace.c b/rts/Trace.c index 3defedbe2f..8978e2722b 100644 --- a/rts/Trace.c +++ b/rts/Trace.c @@ -12,7 +12,7 @@ // internal headers #include "Trace.h" -#ifdef TRACING +#if defined(TRACING) #include "GetTime.h" #include "GetEnv.h" @@ -23,7 +23,7 @@ #include "Printer.h" #include "RtsFlags.h" -#ifdef HAVE_UNISTD_H +#if defined(HAVE_UNISTD_H) #include <unistd.h> #endif @@ -35,7 +35,7 @@ int TRACE_spark_full; int TRACE_user; int TRACE_cap; -#ifdef THREADED_RTS +#if defined(THREADED_RTS) static Mutex trace_utx; #endif @@ -54,7 +54,7 @@ void initTracing (void) { const EventLogWriter *eventlog_writer = getEventLogWriter(); -#ifdef THREADED_RTS +#if defined(THREADED_RTS) initMutex(&trace_utx); #endif @@ -141,10 +141,10 @@ void tracingAddCapapilities (uint32_t from, uint32_t to) Emitting trace messages/events --------------------------------------------------------------------------- */ -#ifdef DEBUG +#if defined(DEBUG) static void tracePreface (void) { -#ifdef THREADED_RTS +#if defined(THREADED_RTS) debugBelch("%12lx: ", (unsigned long)osThreadId()); #endif if (RtsFlags.TraceFlags.timestamp) { @@ -153,7 +153,7 @@ static void tracePreface (void) } #endif -#ifdef DEBUG +#if defined(DEBUG) static char *thread_stop_reasons[] = { [HeapOverflow] = "heap overflow", [StackOverflow] = "stack overflow", @@ -176,7 +176,7 @@ static char *thread_stop_reasons[] = { }; #endif -#ifdef DEBUG +#if defined(DEBUG) static void traceSchedEvent_stderr (Capability *cap, EventTypeNum tag, StgTSO *tso, StgWord info1 STG_UNUSED, @@ -229,7 +229,7 @@ static void traceSchedEvent_stderr (Capability *cap, EventTypeNum tag, void traceSchedEvent_ (Capability *cap, EventTypeNum tag, StgTSO *tso, StgWord info1, StgWord info2) { -#ifdef DEBUG +#if defined(DEBUG) if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) { traceSchedEvent_stderr(cap, tag, tso, info1, info2); } else @@ -239,7 +239,7 @@ void traceSchedEvent_ (Capability *cap, EventTypeNum tag, } } -#ifdef DEBUG +#if defined(DEBUG) static void traceGcEvent_stderr (Capability *cap, EventTypeNum tag) { ACQUIRE_LOCK(&trace_utx); @@ -281,7 +281,7 @@ static void traceGcEvent_stderr (Capability *cap, EventTypeNum tag) void traceGcEvent_ (Capability *cap, EventTypeNum tag) { -#ifdef DEBUG +#if defined(DEBUG) if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) { traceGcEvent_stderr(cap, tag); } else @@ -294,7 +294,7 @@ void traceGcEvent_ (Capability *cap, EventTypeNum tag) void traceGcEventAtT_ (Capability *cap, StgWord64 ts, EventTypeNum tag) { -#ifdef DEBUG +#if defined(DEBUG) if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) { traceGcEvent_stderr(cap, tag); } else @@ -310,7 +310,7 @@ void traceHeapEvent_ (Capability *cap, CapsetID heap_capset, W_ info1) { -#ifdef DEBUG +#if defined(DEBUG) if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) { /* no stderr equivalent for these ones */ } else @@ -327,7 +327,7 @@ void traceEventHeapInfo_ (CapsetID heap_capset, W_ mblockSize, W_ blockSize) { -#ifdef DEBUG +#if defined(DEBUG) if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) { /* no stderr equivalent for these ones */ } else @@ -349,7 +349,7 @@ void traceEventGcStats_ (Capability *cap, W_ par_max_copied, W_ par_tot_copied) { -#ifdef DEBUG +#if defined(DEBUG) if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) { /* no stderr equivalent for these ones */ } else @@ -364,7 +364,7 @@ void traceEventGcStats_ (Capability *cap, void traceCapEvent_ (Capability *cap, EventTypeNum tag) { -#ifdef DEBUG +#if defined(DEBUG) if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) { ACQUIRE_LOCK(&trace_utx); @@ -397,7 +397,7 @@ void traceCapsetEvent_ (EventTypeNum tag, CapsetID capset, StgWord info) { -#ifdef DEBUG +#if defined(DEBUG) if (RtsFlags.TraceFlags.tracing == TRACE_STDERR && TRACE_sched) // When events go to stderr, it is annoying to see the capset // events every time, so we only emit them with -Ds. @@ -482,7 +482,7 @@ void traceOSProcessInfo_(void) { } } -#ifdef DEBUG +#if defined(DEBUG) static void traceSparkEvent_stderr (Capability *cap, EventTypeNum tag, StgWord info1) { @@ -534,7 +534,7 @@ static void traceSparkEvent_stderr (Capability *cap, EventTypeNum tag, void traceSparkEvent_ (Capability *cap, EventTypeNum tag, StgWord info1) { -#ifdef DEBUG +#if defined(DEBUG) if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) { traceSparkEvent_stderr(cap, tag, info1); } else @@ -548,7 +548,7 @@ void traceSparkCounters_ (Capability *cap, SparkCounters counters, StgWord remaining) { -#ifdef DEBUG +#if defined(DEBUG) if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) { /* we currently don't do debug tracing of spark stats but we must test for TRACE_STDERR because of the !eventlog_enabled case. */ @@ -562,7 +562,7 @@ void traceSparkCounters_ (Capability *cap, void traceTaskCreate_ (Task *task, Capability *cap) { -#ifdef DEBUG +#if defined(DEBUG) if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) { /* We currently don't do debug tracing of tasks but we must test for TRACE_STDERR because of the !eventlog_enabled case. */ @@ -579,7 +579,7 @@ void traceTaskMigrate_ (Task *task, Capability *cap, Capability *new_cap) { -#ifdef DEBUG +#if defined(DEBUG) if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) { /* We currently don't do debug tracing of tasks but we must test for TRACE_STDERR because of the !eventlog_enabled case. */ @@ -593,7 +593,7 @@ void traceTaskMigrate_ (Task *task, void traceTaskDelete_ (Task *task) { -#ifdef DEBUG +#if defined(DEBUG) if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) { /* We currently don't do debug tracing of tasks but we must test for TRACE_STDERR because of the !eventlog_enabled case. */ @@ -627,7 +627,7 @@ void traceHeapProfSampleString(StgWord8 profile_id, } } -#ifdef PROFILING +#if defined(PROFILING) void traceHeapProfCostCentre(StgWord32 ccID, const char *label, const char *module, @@ -648,7 +648,7 @@ void traceHeapProfSampleCostCentre(StgWord8 profile_id, } #endif -#ifdef DEBUG +#if defined(DEBUG) static void vtraceCap_stderr(Capability *cap, char *msg, va_list ap) { ACQUIRE_LOCK(&trace_utx); @@ -675,7 +675,7 @@ void traceCap_(Capability *cap, char *msg, ...) va_list ap; va_start(ap,msg); -#ifdef DEBUG +#if defined(DEBUG) if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) { vtraceCap_stderr(cap, msg, ap); } else @@ -687,7 +687,7 @@ void traceCap_(Capability *cap, char *msg, ...) va_end(ap); } -#ifdef DEBUG +#if defined(DEBUG) static void vtrace_stderr(char *msg, va_list ap) { ACQUIRE_LOCK(&trace_utx); @@ -705,7 +705,7 @@ void trace_(char *msg, ...) va_list ap; va_start(ap,msg); -#ifdef DEBUG +#if defined(DEBUG) if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) { vtrace_stderr(msg, ap); } else @@ -723,7 +723,7 @@ void traceUserMsg(Capability *cap, char *msg) by the wrappers in Trace.h. But traceUserMsg is special since it has no wrapper (it's called from cmm code), so we check TRACE_user here */ -#ifdef DEBUG +#if defined(DEBUG) if (RtsFlags.TraceFlags.tracing == TRACE_STDERR && TRACE_user) { // Use "%s" as format string to ignore format specifiers in msg (#3874). traceCap_stderr(cap, "%s", msg); @@ -742,7 +742,7 @@ 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 defined(DEBUG) if (RtsFlags.TraceFlags.tracing == TRACE_STDERR && TRACE_user) { traceCap_stderr(cap, "User marker: %s", markername); } else @@ -760,7 +760,7 @@ void traceThreadLabel_(Capability *cap, StgTSO *tso, char *label) { -#ifdef DEBUG +#if defined(DEBUG) if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) { ACQUIRE_LOCK(&trace_utx); tracePreface(); @@ -776,7 +776,7 @@ void traceThreadLabel_(Capability *cap, void traceThreadStatus_ (StgTSO *tso USED_IF_DEBUG) { -#ifdef DEBUG +#if defined(DEBUG) if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) { printThreadStatus(tso); } else @@ -786,7 +786,7 @@ void traceThreadStatus_ (StgTSO *tso USED_IF_DEBUG) } } -#ifdef DEBUG +#if defined(DEBUG) void traceBegin (const char *str, ...) { va_list ap; |