count "dud" sparks (expressions that were already evaluated when sparked)
authorSimon Marlow <marlowsd@gmail.com>
Mon, 1 Nov 2010 12:41:43 +0000 (12:41 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Mon, 1 Nov 2010 12:41:43 +0000 (12:41 +0000)
rts/Capability.c
rts/Capability.h
rts/Sparks.c
rts/Stats.c

index 345bd39..9f7d152 100644 (file)
@@ -225,6 +225,7 @@ initCapability( Capability *cap, nat i )
     cap->returning_tasks_tl = NULL;
     cap->inbox              = (Message*)END_TSO_QUEUE;
     cap->sparks_created     = 0;
+    cap->sparks_dud         = 0;
     cap->sparks_converted   = 0;
     cap->sparks_pruned      = 0;
 #endif
index a15ce15..e50dba3 100644 (file)
@@ -99,6 +99,7 @@ struct Capability_ {
 
     // Stats on spark creation/conversion
     nat sparks_created;
+    nat sparks_dud;
     nat sparks_converted;
     nat sparks_pruned;
 #endif
index 7e2556d..2498cb3 100644 (file)
@@ -71,9 +71,10 @@ newSpark (StgRegTable *reg, StgClosure *p)
 
     if (closure_SHOULD_SPARK(p)) {
         pushWSDeque(pool,p);
-    }  
-
-    cap->sparks_created++;
+        cap->sparks_created++;
+    } else {
+        cap->sparks_dud++;
+    }
 
     return 1;
 }
index e519c94..a507147 100644 (file)
@@ -636,16 +636,18 @@ stat_exit(int alloc)
             {
                 nat i;
                 lnat sparks_created   = 0;
+                lnat sparks_dud       = 0;
                 lnat sparks_converted = 0;
                 lnat sparks_pruned    = 0;
                 for (i = 0; i < n_capabilities; i++) {
                     sparks_created   += capabilities[i].sparks_created;
+                    sparks_dud       += capabilities[i].sparks_dud;
                     sparks_converted += capabilities[i].sparks_converted;
                     sparks_pruned    += capabilities[i].sparks_pruned;
                 }
 
-                statsPrintf("  SPARKS: %ld (%ld converted, %ld pruned)\n\n",
-                            sparks_created, sparks_converted, sparks_pruned);
+                statsPrintf("  SPARKS: %ld (%ld converted, %ld dud, %ld pruned)\n\n",
+                            sparks_created + sparks_dud, sparks_converted, sparks_dud, sparks_pruned);
             }
 #endif