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

changeset 9896
1b8c45b8216a
parent 9787
9f28a4cac6d9
parent 9861
a248d0be1309
child 9931
fd44df5e3bc3
equal deleted inserted replaced
9847:b4fd7e078c54 9896:1b8c45b8216a
3577 PrintRSetsClosure cl("Printing All RSets");; 3577 PrintRSetsClosure cl("Printing All RSets");;
3578 heap_region_iterate(&cl); 3578 heap_region_iterate(&cl);
3579 } 3579 }
3580 #endif // PRODUCT 3580 #endif // PRODUCT
3581 3581
3582 G1HeapSummary G1CollectedHeap::create_g1_heap_summary() {
3583
3584 size_t eden_used_bytes = _young_list->eden_used_bytes();
3585 size_t survivor_used_bytes = _young_list->survivor_used_bytes();
3586 size_t heap_used = Heap_lock->owned_by_self() ? used() : used_unlocked();
3587
3588 size_t eden_capacity_bytes =
3589 (g1_policy()->young_list_target_length() * HeapRegion::GrainBytes) - survivor_used_bytes;
3590
3591 VirtualSpaceSummary heap_summary = create_heap_space_summary();
3592 return G1HeapSummary(heap_summary, heap_used, eden_used_bytes,
3593 eden_capacity_bytes, survivor_used_bytes, num_regions());
3594 }
3595
3596 void G1CollectedHeap::trace_heap(GCWhen::Type when, GCTracer* gc_tracer) {
3597 const G1HeapSummary& heap_summary = create_g1_heap_summary();
3598 gc_tracer->report_gc_heap_summary(when, heap_summary);
3599
3600 const MetaspaceSummary& metaspace_summary = create_metaspace_summary();
3601 gc_tracer->report_metaspace_summary(when, metaspace_summary);
3602 }
3603
3582 G1CollectedHeap* G1CollectedHeap::heap() { 3604 G1CollectedHeap* G1CollectedHeap::heap() {
3583 assert(_sh->kind() == CollectedHeap::G1CollectedHeap, 3605 assert(_sh->kind() == CollectedHeap::G1CollectedHeap,
3584 "not a garbage-first heap"); 3606 "not a garbage-first heap");
3585 return _g1h; 3607 return _g1h;
3586 } 3608 }
4094 gclog_or_tty->print_cr("\nBefore recording pause start.\nYoung_list:"); 4116 gclog_or_tty->print_cr("\nBefore recording pause start.\nYoung_list:");
4095 _young_list->print(); 4117 _young_list->print();
4096 g1_policy()->print_collection_set(g1_policy()->inc_cset_head(), gclog_or_tty); 4118 g1_policy()->print_collection_set(g1_policy()->inc_cset_head(), gclog_or_tty);
4097 #endif // YOUNG_LIST_VERBOSE 4119 #endif // YOUNG_LIST_VERBOSE
4098 4120
4099 g1_policy()->record_collection_pause_start(sample_start_time_sec); 4121 g1_policy()->record_collection_pause_start(sample_start_time_sec, *_gc_tracer_stw);
4100 4122
4101 double scan_wait_start = os::elapsedTime(); 4123 double scan_wait_start = os::elapsedTime();
4102 // We have to wait until the CM threads finish scanning the 4124 // We have to wait until the CM threads finish scanning the
4103 // root regions as it's the only way to ensure that all the 4125 // root regions as it's the only way to ensure that all the
4104 // objects on them have been correctly scanned before we start 4126 // objects on them have been correctly scanned before we start

mercurial