src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp

Print this page
rev 6072 : 8036703: Add trace event with statistics for the metaspace chunk free lists

@@ -2491,14 +2491,29 @@
 
 void CMSCollector::save_heap_summary() {
   GenCollectedHeap* gch = GenCollectedHeap::heap();
   _last_heap_summary = gch->create_heap_summary();
   _last_metaspace_summary = gch->create_metaspace_summary();
+
+  for (int i = 0; i < Metaspace::MetadataTypeCount; i++) {
+    Metaspace::MetadataType mdtype = (Metaspace::MetadataType) i;
+    if (MetaspaceAux::has_chunk_free_list(mdtype)) {
+      _last_metaspace_free_list_summaries[i] = MetaspaceAux::chunk_free_list_summary(mdtype);
+    }
+  }
 }
 
 void CMSCollector::report_heap_summary(GCWhen::Type when) {
   _gc_tracer_cm->report_gc_heap_summary(when, _last_heap_summary, _last_metaspace_summary);
+
+  for (int i = 0; i < Metaspace::MetadataTypeCount; i++) {
+    Metaspace::MetadataType mdtype = (Metaspace::MetadataType) i;
+    if (MetaspaceAux::has_chunk_free_list(mdtype)) {
+      _gc_tracer_cm->report_metaspace_chunk_free_list_summary(when, mdtype,
+        _last_metaspace_free_list_summaries[i]);
+    }
+  }
 }
 
 void CMSCollector::collect_in_foreground(bool clear_all_soft_refs, GCCause::Cause cause) {
   assert(_foregroundGCIsActive && !_foregroundGCShouldWait,
          "Foreground collector should be waiting, not executing");