Add erf, erfc, erfff, erfcf (#3536)
[ghc-hetmet.git] / rts / Trace.c
index 20debdc..7eabce9 100644 (file)
@@ -19,6 +19,7 @@
 #include "Threads.h"
 #include "Printer.h"
 
+#ifdef DEBUG
 // debugging flags, set with +RTS -D<something>
 int DEBUG_sched;
 int DEBUG_interp;
@@ -36,6 +37,7 @@ int DEBUG_linker;
 int DEBUG_squeeze;
 int DEBUG_hpc;
 int DEBUG_sparks;
+#endif
 
 // events
 int TRACE_sched;
@@ -44,6 +46,8 @@ int TRACE_sched;
 static Mutex trace_utx;
 #endif
 
+static rtsBool eventlog_enabled;
+
 /* ---------------------------------------------------------------------------
    Starting up / shuttting down the tracing facilities
  --------------------------------------------------------------------------- */
@@ -54,6 +58,11 @@ void initTracing (void)
     initMutex(&trace_utx);
 #endif
 
+#define TRACE_FLAG(name, class) \
+    class = RtsFlags.TraceFlags.name ? 1 : 0;
+
+    TRACE_FLAG(scheduler, TRACE_sched);
+
 #ifdef DEBUG
 #define DEBUG_FLAG(name, class) \
     class = RtsFlags.DebugFlags.name ? 1 : 0;
@@ -76,22 +85,42 @@ void initTracing (void)
     DEBUG_FLAG(sparks,       DEBUG_sparks);
 #endif
 
-#define TRACE_FLAG(name, class) \
-    class = RtsFlags.TraceFlags.name ? 1 : 0;
-
-    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
+        );
 
-    initEventLogging();
+    if (eventlog_enabled) {
+        initEventLogging();
+    }
 }
 
 void endTracing (void)
 {
-    endEventLogging();
+    if (eventlog_enabled) {
+        endEventLogging();
+    }
 }
 
 void freeTracing (void)
 {
-    freeEventLogging();
+    if (eventlog_enabled) {
+        freeEventLogging();
+    }
 }
 
 /* ---------------------------------------------------------------------------