< prev index next >
src/share/vm/gc/g1/g1CollectedHeap.cpp
Print this page
rev 8818 : [mq]: dlindholm-changes
*** 67,76 ****
--- 67,77 ----
#include "runtime/atomic.inline.hpp"
#include "runtime/orderAccess.inline.hpp"
#include "runtime/vmThread.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/stack.inline.hpp"
+ #include "tracefiles/traceEventClasses.hpp"
size_t G1CollectedHeap::_humongous_object_threshold_in_words = 0;
// turn it on so that the contents of the young list (scan-only /
// to-be-collected) are printed at "strategic" points before / during
*** 1942,1953 ****
_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),
_expand_heap_after_alloc_failure(true),
_surviving_young_words(NULL),
_old_marking_cycles_started(0),
_old_marking_cycles_completed(0),
_heap_summary_sent(false),
--- 1943,1954 ----
_archive_allocator(NULL),
_free_regions_coming(false),
_young_list(new YoungList(this)),
_gc_time_stamp(0),
_summary_bytes_used(0),
! _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,5548 ****
--- 5540,5551 ----
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,5581 ****
--- 5575,5616 ----
redirty_logged_cards();
COMPILER2_PRESENT(DerivedPointerTable::update_pointers());
}
+ void G1CollectedHeap::record_obj_copy_mem_stats() {
+ EventGCG1EvacuationYoungStatistics surv_evt;
+ if (surv_evt.should_commit()) {
+ surv_evt.set_gcId(GCId::peek().id());
+ surv_evt.set_allocated(_survivor_evac_stats.allocated() * HeapWordSize);
+ surv_evt.set_wasted(_survivor_evac_stats.wasted() * HeapWordSize);
+ surv_evt.set_used(_survivor_evac_stats.used() * HeapWordSize);
+ surv_evt.set_undoWaste(_survivor_evac_stats.undo_wasted() * HeapWordSize);
+ surv_evt.set_regionEndWaste(_survivor_evac_stats.region_end_waste() * HeapWordSize);
+ surv_evt.set_regionsRefilled(_survivor_evac_stats.regions_refilled());
+ surv_evt.set_directAllocated(_survivor_evac_stats.direct_allocated() * HeapWordSize);
+ surv_evt.set_failureUsed(_survivor_evac_stats.failure_used() * HeapWordSize);
+ surv_evt.set_failureWaste(_survivor_evac_stats.failure_waste() * HeapWordSize);
+ surv_evt.commit();
+ }
+
+ EventGCG1EvacuationOldStatistics old_evt;
+ if (old_evt.should_commit()) {
+ old_evt.set_gcId(GCId::peek().id());
+ old_evt.set_allocated(_old_evac_stats.allocated() * HeapWordSize);
+ old_evt.set_wasted(_old_evac_stats.wasted() * HeapWordSize);
+ old_evt.set_used(_old_evac_stats.used() * HeapWordSize);
+ old_evt.set_undoWaste(_old_evac_stats.undo_wasted() * HeapWordSize);
+ old_evt.set_regionEndWaste(_old_evac_stats.region_end_waste() * HeapWordSize);
+ old_evt.set_regionsRefilled(_old_evac_stats.regions_refilled());
+ old_evt.set_directAllocated(_old_evac_stats.direct_allocated() * HeapWordSize);
+ old_evt.set_failureUsed(_old_evac_stats.failure_used() * HeapWordSize);
+ old_evt.set_failureWaste(_old_evac_stats.failure_waste() * HeapWordSize);
+ old_evt.commit();
+ }
+ }
+
void G1CollectedHeap::free_region(HeapRegion* hr,
FreeRegionList* free_list,
bool par,
bool locked) {
assert(!hr->is_free(), "the region should not be free");
*** 5970,5979 ****
--- 6005,6019 ----
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 >