[sgen] Move STW GC events to sgen-stw.c so they are properly reported.
authorRodrigo Kumpera <kumpera@gmail.com>
Tue, 13 Jun 2017 23:34:24 +0000 (16:34 -0700)
committerRodrigo Kumpera <kumpera@gmail.com>
Wed, 14 Jun 2017 21:54:10 +0000 (14:54 -0700)
mono/metadata/sgen-client-mono.h
mono/metadata/sgen-stw.c

index eac61f32577fa1ff64af811766f65449fed621f1..78c0126396cb308433c982290abedba0ba81b93a 100644 (file)
@@ -345,32 +345,24 @@ static void G_GNUC_UNUSED
 sgen_client_binary_protocol_world_stopping (int generation, long long timestamp, gpointer thread)
 {
        MONO_GC_WORLD_STOP_BEGIN ();
-
-       mono_profiler_gc_event (MONO_GC_EVENT_PRE_STOP_WORLD, generation);
 }
 
 static void G_GNUC_UNUSED
 sgen_client_binary_protocol_world_stopped (int generation, long long timestamp, long long total_major_cards, long long marked_major_cards, long long total_los_cards, long long marked_los_cards)
 {
        MONO_GC_WORLD_STOP_END ();
-
-       mono_profiler_gc_event (MONO_GC_EVENT_POST_STOP_WORLD, generation);
 }
 
 static void G_GNUC_UNUSED
 sgen_client_binary_protocol_world_restarting (int generation, long long timestamp, long long total_major_cards, long long marked_major_cards, long long total_los_cards, long long marked_los_cards)
 {
        MONO_GC_WORLD_RESTART_BEGIN (generation);
-
-       mono_profiler_gc_event (MONO_GC_EVENT_PRE_START_WORLD, generation);
 }
 
 static void G_GNUC_UNUSED
 sgen_client_binary_protocol_world_restarted (int generation, long long timestamp)
 {
        MONO_GC_WORLD_RESTART_END (generation);
-
-       mono_profiler_gc_event (MONO_GC_EVENT_POST_START_WORLD, generation);
 }
 
 static void G_GNUC_UNUSED
index fc1de7c25f87aa9759f19d52f0741c0b911fd71f..96fec4d39ab364be201e6096cb67f7518ff0c89e 100644 (file)
@@ -109,6 +109,8 @@ sgen_client_stop_world (int generation)
        if (G_UNLIKELY (mono_profiler_events & MONO_PROFILE_GC_MOVES))
                mono_sgen_gc_event_moves ();
 
+       mono_profiler_gc_event (MONO_GC_EVENT_PRE_STOP_WORLD, generation);
+
        acquire_gc_locks ();
 
        mono_profiler_gc_event (MONO_GC_EVENT_PRE_STOP_WORLD_LOCKED, generation);
@@ -126,6 +128,8 @@ sgen_client_stop_world (int generation)
 
        SGEN_LOG (3, "world stopped");
 
+       mono_profiler_gc_event (MONO_GC_EVENT_POST_STOP_WORLD, generation);
+
        TV_GETTIME (end_handshake);
        time_stop_world += TV_ELAPSED (stop_world_time, end_handshake);
 
@@ -147,6 +151,8 @@ sgen_client_restart_world (int generation, gint64 *stw_time)
        if (G_UNLIKELY (mono_profiler_events & MONO_PROFILE_GC_MOVES))
                mono_sgen_gc_event_moves ();
 
+       mono_profiler_gc_event (MONO_GC_EVENT_PRE_START_WORLD, generation);
+
        FOREACH_THREAD (info) {
                info->client_info.stack_start = NULL;
                memset (&info->client_info.ctx, 0, sizeof (MonoContext));
@@ -164,6 +170,8 @@ sgen_client_restart_world (int generation, gint64 *stw_time)
 
        SGEN_LOG (2, "restarted (pause time: %d usec, max: %d)", (int)usec, (int)max_pause_usec);
 
+       mono_profiler_gc_event (MONO_GC_EVENT_POST_START_WORLD, generation);
+
        /*
         * We must release the thread info suspend lock after doing
         * the thread handshake.  Otherwise, if the GC stops the world