< prev index next >

src/share/vm/gc/g1/g1CollectedHeap.cpp

Print this page
rev 8816 : imported patch 8073013-add-detailed-information-about-plab-memory-usage

@@ -1942,12 +1942,12 @@
   _archive_allocator(NULL),
   _free_regions_coming(false),
   _young_list(new YoungList(this)),
   _gc_time_stamp(0),
   _summary_bytes_used(0),
-  _survivor_plab_stats(YoungPLABSize, PLABWeight),
-  _old_plab_stats(OldPLABSize, PLABWeight),
+  _survivor_evac_stats(YoungPLABSize, PLABWeight),
+  _old_evac_stats(OldPLABSize, PLABWeight),
   _expand_heap_after_alloc_failure(true),
   _surviving_young_words(NULL),
   _old_marking_cycles_started(0),
   _old_marking_cycles_completed(0),
   _heap_summary_sent(false),

@@ -5539,10 +5539,12 @@
 
     double fixup_time_ms = (os::elapsedTime() - fixup_start) * 1000.0;
     phase_times->record_string_dedup_fixup_time(fixup_time_ms);
   }
 
+  record_obj_copy_mem_stats();
+
   _allocator->release_gc_alloc_regions(evacuation_info);
   g1_rem_set()->cleanup_after_oops_into_collection_set_do();
 
   // Reset and re-enable the hot card cache.
   // Note the counts for the cards in the regions in the

@@ -5572,10 +5574,15 @@
 
   redirty_logged_cards();
   COMPILER2_PRESENT(DerivedPointerTable::update_pointers());
 }
 
+void G1CollectedHeap::record_obj_copy_mem_stats() {
+  _survivor_evac_stats.send_obj_copy_mem_event(InCSetState::to_gen_number(InCSetState::Young));
+  _old_evac_stats.send_obj_copy_mem_event(InCSetState::to_gen_number(InCSetState::Old));
+}
+
 void G1CollectedHeap::free_region(HeapRegion* hr,
                                   FreeRegionList* free_list,
                                   bool par,
                                   bool locked) {
   assert(!hr->is_free(), "the region should not be free");

@@ -5970,10 +5977,15 @@
         cur->set_young_index_in_cset(-1);
       }
       cur->set_evacuation_failed(false);
       // The region is now considered to be old.
       cur->set_old();
+      // Do some allocation statistics accounting. Regions that failed evacuation
+      // are always made old, so there is no need to update anything in the young
+      // gen statistics, but we need to update old gen statistics.
+      size_t used_words = cur->marked_bytes() / HeapWordSize;
+      _old_evac_stats.add_failure_used_and_waste(used_words, HeapRegion::GrainWords - used_words);
       _old_set.add(cur);
       evacuation_info.increment_collectionset_used_after(cur->used());
     }
     cur = next;
   }
< prev index next >