[sgen] Fix logging of major heap size with concurrent sweep
authorVlad Brezae <brezaevlad@gmail.com>
Tue, 29 Mar 2016 23:07:14 +0000 (02:07 +0300)
committerVlad Brezae <brezaevlad@gmail.com>
Tue, 29 Mar 2016 23:07:14 +0000 (02:07 +0300)
We used to log the major heap size before the sweep job finished. Remove the major heap logging at collection end time and add a separate log entry at sweep finish time.

mono/metadata/sgen-mono.c
mono/sgen/sgen-marksweep.c
mono/sgen/sgen-memory-governor.c
mono/sgen/sgen-memory-governor.h

index 42f860df05d7bc979130e9672a251d0f4535c5b9..ad3c31fdb65ad1c1ccb81a62c56017123a1b2ee6 100644 (file)
@@ -2747,13 +2747,11 @@ sgen_client_log_timing (GGTimingInfo *info, mword last_major_num_sections, mword
        if (!info->is_overflow)
                sprintf (full_timing_buff, "total %.2fms, bridge %.2fms", info->stw_time / 10000.0f, (int)info->bridge_time / 10000.0f);
        if (info->generation == GENERATION_OLD)
-               mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_MAJOR%s: (%s) pause %.2fms, %s major %dK/%dK los %dK/%dK",
+               mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_MAJOR%s: (%s) pause %.2fms, %s los %dK/%dK",
                        info->is_overflow ? "_OVERFLOW" : "",
                        info->reason ? info->reason : "",
                        (int)info->total_time / 10000.0f,
                        full_timing_buff,
-                       major_collector->section_size * num_major_sections / 1024,
-                       major_collector->section_size * last_major_num_sections / 1024,
                        los_memory_usage / 1024,
                        last_los_memory_usage / 1024);
        else
index b475ef3ad79ab82910792b1698028da913793f79..d2ebc5d3e9c0d29edbf2238952e3ad4a446f9f6b 100644 (file)
@@ -1650,6 +1650,8 @@ sweep_finish (void)
                }
        }
 
+       sgen_memgov_major_post_sweep ();
+
        set_sweep_state (SWEEP_STATE_SWEPT, SWEEP_STATE_COMPACTING);
 }
 
index f18edf82c8ee5381123783c3c83fb5252d857023..345ce46b868fe32d70120ba0efc0808ae251e203 100644 (file)
@@ -189,6 +189,17 @@ sgen_memgov_major_pre_sweep (void)
        }
 }
 
+void
+sgen_memgov_major_post_sweep (void)
+{
+       mword num_major_sections = major_collector.get_num_major_sections ();
+
+       mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_MAJOR_SWEEP: major %dK/%dK",
+               num_major_sections * major_collector.section_size / 1024,
+               last_major_num_sections * major_collector.section_size / 1024);
+       last_major_num_sections = num_major_sections;
+}
+
 void
 sgen_memgov_major_collection_start (void)
 {
@@ -224,7 +235,6 @@ sgen_memgov_collection_end (int generation, GGTimingInfo* info, int info_count)
                if (info[i].generation != -1)
                        sgen_client_log_timing (&info [i], last_major_num_sections, last_los_memory_usage);
        }
-       last_major_num_sections = major_collector.get_num_major_sections ();
        last_los_memory_usage = los_memory_usage;
 }
 
index 669b59734e99200ffadae2dc540a7b8137f6349c..71c31f56a19327a95a56f6edfc89a83a1198c87a 100644 (file)
@@ -34,6 +34,7 @@ void sgen_memgov_minor_collection_start (void);
 void sgen_memgov_minor_collection_end (void);
 
 void sgen_memgov_major_pre_sweep (void);
+void sgen_memgov_major_post_sweep (void);
 void sgen_memgov_major_collection_start (void);
 void sgen_memgov_major_collection_end (gboolean forced);