[commit: ghc] master: Add a comment about oddity with yieldThread() and timing results on Linux (40dd50a)
Simon Marlow
marlowsd at gmail.com
Tue Dec 13 16:02:57 CET 2011
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/40dd50a9d1d92a7bd8526b54ca5fcdd1eb95d42f
>---------------------------------------------------------------
commit 40dd50a9d1d92a7bd8526b54ca5fcdd1eb95d42f
Author: Simon Marlow <marlowsd at gmail.com>
Date: Mon Dec 12 16:28:29 2011 +0000
Add a comment about oddity with yieldThread() and timing results on Linux
>---------------------------------------------------------------
rts/sm/GC.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/rts/sm/GC.c b/rts/sm/GC.c
index 928f444..993de51 100644
--- a/rts/sm/GC.c
+++ b/rts/sm/GC.c
@@ -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);
More information about the Cvs-ghc
mailing list