include spark counters in the sparks trace class
[ghc.git] / rts / Trace.h
index 910afbd..34efdf6 100644 (file)
@@ -62,6 +62,7 @@ extern int DEBUG_sparks;
 
 // events
 extern int TRACE_sched;
+extern int TRACE_spark;
 
 // -----------------------------------------------------------------------------
 // Posting events
@@ -93,6 +94,11 @@ void traceEnd (void);
         traceSchedEvent_(cap, tag, tso, info1, info2); \
     }
 
+#define traceSparkEvent(cap, tag, tso, other)   \
+    if (RTS_UNLIKELY(TRACE_spark)) {            \
+        traceSchedEvent_(cap, tag, tso, other, 0); \
+    }
+
 void traceSchedEvent_ (Capability *cap, EventTypeNum tag, 
                        StgTSO *tso, StgWord info1, StgWord info2);
 
@@ -192,6 +198,7 @@ void traceSparkCounters_ (Capability *cap,
 
 #define traceSchedEvent(cap, tag, tso, other) /* nothing */
 #define traceSchedEvent2(cap, tag, tso, other, info) /* nothing */
+#define traceSparkEvent(cap, tag, tso, other) /* nothing */
 #define traceEvent(cap, tag) /* nothing */
 #define traceCap(class, cap, msg, ...) /* nothing */
 #define trace(class, msg, ...) /* nothing */
@@ -402,7 +409,7 @@ INLINE_HEADER void traceEventRequestParGc(Capability *cap STG_UNUSED)
 INLINE_HEADER void traceEventRunSpark(Capability *cap STG_UNUSED, 
                                       StgTSO     *tso STG_UNUSED)
 {
-    traceSchedEvent(cap, EVENT_RUN_SPARK, tso, 0);
+    traceSparkEvent(cap, EVENT_RUN_SPARK, tso, 0);
     dtraceRunSpark((EventCapNo)cap->no, (EventThreadID)tso->id);
 }
 
@@ -410,7 +417,7 @@ INLINE_HEADER void traceEventStealSpark(Capability *cap        STG_UNUSED,
                                         StgTSO     *tso        STG_UNUSED,
                                         nat         victim_cap STG_UNUSED)
 {
-    traceSchedEvent(cap, EVENT_STEAL_SPARK, tso, victim_cap);
+    traceSparkEvent(cap, EVENT_STEAL_SPARK, tso, victim_cap);
     dtraceStealSpark((EventCapNo)cap->no, (EventThreadID)tso->id,
                      (EventCapNo)victim_cap);
 }
@@ -418,7 +425,7 @@ INLINE_HEADER void traceEventStealSpark(Capability *cap        STG_UNUSED,
 INLINE_HEADER void traceEventCreateSparkThread(Capability  *cap      STG_UNUSED, 
                                                StgThreadID spark_tid STG_UNUSED)
 {
-    traceSchedEvent(cap, EVENT_CREATE_SPARK_THREAD, 0, spark_tid);
+    traceSparkEvent(cap, EVENT_CREATE_SPARK_THREAD, 0, spark_tid);
     dtraceCreateSparkThread((EventCapNo)cap->no, (EventThreadID)spark_tid);
 }
 
@@ -491,7 +498,7 @@ INLINE_HEADER void traceOSProcessInfo(void)
 INLINE_HEADER void traceSparkCounters(Capability *cap STG_UNUSED)
 {
 #ifdef THREADED_RTS
-    if (RTS_UNLIKELY(TRACE_sched)) {
+    if (RTS_UNLIKELY(TRACE_spark)) {
         traceSparkCounters_(cap, cap->spark_stats, sparkPoolSize(cap->sparks));
     }
 #endif