[pypy-commit] stmgc c8-marker: Re-add the remining timing_events

arigo noreply at buildbot.pypy.org
Mon Mar 9 10:13:47 CET 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: c8-marker
Changeset: r1703:a26d30f127f1
Date: 2015-03-09 10:14 +0100
http://bitbucket.org/pypy/stmgc/changeset/a26d30f127f1/

Log:	Re-add the remining timing_events

diff --git a/c8/stm/core.c b/c8/stm/core.c
--- a/c8/stm/core.c
+++ b/c8/stm/core.c
@@ -1268,11 +1268,7 @@
 
     /* if a major collection is required, do it here */
     if (is_major_collection_requested()) {
-        synchronize_all_threads(STOP_OTHERS_UNTIL_MUTEX_UNLOCK);
-
-        if (is_major_collection_requested()) {   /* if *still* true */
-            major_collection_now_at_safe_point();
-        }
+        major_collection_with_mutex();
     }
 
     _verify_cards_cleared_in_all_lists(get_priv_segment(STM_SEGMENT->segment_num));
diff --git a/c8/stm/gcpage.c b/c8/stm/gcpage.c
--- a/c8/stm/gcpage.c
+++ b/c8/stm/gcpage.c
@@ -131,6 +131,19 @@
 /************************************************************/
 
 
+static void major_collection_with_mutex(void)
+{
+    timing_event(STM_SEGMENT->running_thread, STM_GC_MAJOR_START);
+
+    synchronize_all_threads(STOP_OTHERS_UNTIL_MUTEX_UNLOCK);
+
+    if (is_major_collection_requested()) {   /* if *still* true */
+        major_collection_now_at_safe_point();
+    }
+
+    timing_event(STM_SEGMENT->running_thread, STM_GC_MAJOR_DONE);
+}
+
 static void major_collection_if_requested(void)
 {
     assert(!_has_mutex());
@@ -140,13 +153,7 @@
     s_mutex_lock();
 
     if (is_major_collection_requested()) {   /* if still true */
-
-        synchronize_all_threads(STOP_OTHERS_UNTIL_MUTEX_UNLOCK);
-
-        if (is_major_collection_requested()) {   /* if *still* true */
-            major_collection_now_at_safe_point();
-        }
-
+        major_collection_with_mutex();
     }
 
     s_mutex_unlock();
diff --git a/c8/stm/gcpage.h b/c8/stm/gcpage.h
--- a/c8/stm/gcpage.h
+++ b/c8/stm/gcpage.h
@@ -19,5 +19,6 @@
 
 static void major_collection_if_requested(void);
 static void major_collection_now_at_safe_point(void);
+static void major_collection_with_mutex(void);
 static bool largemalloc_keep_object_at(char *data);   /* for largemalloc.c */
 static bool smallmalloc_keep_object_at(char *data);   /* for smallmalloc.c */
diff --git a/c8/stm/nursery.c b/c8/stm/nursery.c
--- a/c8/stm/nursery.c
+++ b/c8/stm/nursery.c
@@ -563,7 +563,11 @@
 
     stm_safe_point();
 
+    timing_event(STM_SEGMENT->running_thread, STM_GC_MINOR_START);
+
     _do_minor_collection(commit);
+
+    timing_event(STM_SEGMENT->running_thread, STM_GC_MINOR_DONE);
 }
 
 void stm_collect(long level)
diff --git a/c8/stm/sync.c b/c8/stm/sync.c
--- a/c8/stm/sync.c
+++ b/c8/stm/sync.c
@@ -139,10 +139,13 @@
     }
     /* No segment available.  Wait until release_thread_segment()
        signals that one segment has been freed. */
+    timing_event(tl, STM_WAIT_FREE_SEGMENT);
     cond_wait(C_SEGMENT_FREE);
+    timing_event(tl, STM_WAIT_DONE);
 
     /* Return false to the caller, which will call us again */
     return false;
+
  got_num:
     OPT_ASSERT(num >= 0 && num < NB_SEGMENTS-1);
     sync_ctl.in_use1[num+1] = 1;
@@ -296,10 +299,12 @@
 #ifdef STM_TESTS
         abort_with_mutex();
 #endif
+        timing_event(STM_SEGMENT->running_thread, STM_WAIT_SYNC_PAUSE);
         cond_signal(C_AT_SAFE_POINT);
         STM_PSEGMENT->safe_point = SP_WAIT_FOR_C_REQUEST_REMOVED;
         cond_wait(C_REQUEST_REMOVED);
         STM_PSEGMENT->safe_point = SP_RUNNING;
+        timing_event(STM_SEGMENT->running_thread, STM_WAIT_DONE);
     }
 }
 
diff --git a/c8/stmgc.h b/c8/stmgc.h
--- a/c8/stmgc.h
+++ b/c8/stmgc.h
@@ -362,6 +362,7 @@
 
     /* always one STM_WAIT_xxx followed later by STM_WAIT_DONE */
     STM_WAIT_FREE_SEGMENT,
+    STM_WAIT_SYNC_PAUSE,
     STM_WAIT_OTHER_INEVITABLE,
     STM_WAIT_DONE,
 
diff --git a/c8/test/support.py b/c8/test/support.py
--- a/c8/test/support.py
+++ b/c8/test/support.py
@@ -137,6 +137,7 @@
 
     /* always one STM_WAIT_xxx followed later by STM_WAIT_DONE */
     STM_WAIT_FREE_SEGMENT,
+    STM_WAIT_SYNC_PAUSE,
     STM_WAIT_OTHER_INEVITABLE,
     STM_WAIT_DONE,
 


More information about the pypy-commit mailing list