Add a comment about oddity with yieldThread() and timing results on Linux
authorSimon Marlow <marlowsd@gmail.com>
Mon, 12 Dec 2011 16:28:29 +0000 (16:28 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Tue, 13 Dec 2011 15:02:11 +0000 (15:02 +0000)
rts/sm/GC.c

index 928f444..993de51 100644 (file)
@@ -1060,6 +1060,11 @@ gcWorkerThread (Capability *cap)
 
     // Wait until we're told to wake up
     RELEASE_SPIN_LOCK(&gct->mut_spin);
+    // yieldThread();
+    //    Strangely, adding a yieldThread() here makes the CPU time
+    //    measurements more accurate on Linux, perhaps because it syncs
+    //    the CPU time across the multiple cores.  Without this, CPU time
+    //    is heavily skewed towards GC rather than MUT.
     gct->wakeup = GC_THREAD_STANDING_BY;
     debugTrace(DEBUG_gc, "GC thread %d standing by...", gct->thread_index);
     ACQUIRE_SPIN_LOCK(&gct->gc_spin);