[pypy-commit] stmgc default: Count the spinlooping time

arigo noreply at buildbot.pypy.org
Mon Mar 31 15:46:05 CEST 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r1126:a8d0ff724dea
Date: 2014-03-31 15:45 +0200
http://bitbucket.org/pypy/stmgc/changeset/a8d0ff724dea/

Log:	Count the spinlooping time

diff --git a/c7/stm/pages.c b/c7/stm/pages.c
--- a/c7/stm/pages.c
+++ b/c7/stm/pages.c
@@ -30,9 +30,14 @@
 
 static void mutex_pages_lock(void)
 {
+    if (__sync_lock_test_and_set(&pages_ctl.mutex_pages, 1) == 0)
+        return;
+
+    int previous = change_timing_state(STM_TIME_SPIN_LOOP);
     while (__sync_lock_test_and_set(&pages_ctl.mutex_pages, 1) != 0) {
         spin_loop();
     }
+    change_timing_state(previous);
 }
 
 static void mutex_pages_unlock(void)
diff --git a/c7/stm/timing.c b/c7/stm/timing.c
--- a/c7/stm/timing.c
+++ b/c7/stm/timing.c
@@ -55,6 +55,7 @@
     "minor gc",
     "major gc",
     "sync pause",
+    "spin loop",
 };
 
 void stm_flush_timing(stm_thread_local_t *tl, int verbose)
diff --git a/c7/stmgc.h b/c7/stmgc.h
--- a/c7/stmgc.h
+++ b/c7/stmgc.h
@@ -70,6 +70,7 @@
     STM_TIME_MINOR_GC,
     STM_TIME_MAJOR_GC,
     STM_TIME_SYNC_PAUSE,
+    STM_TIME_SPIN_LOOP,
     _STM_TIME_N
 };
 


More information about the pypy-commit mailing list