< prev index next >

src/share/vm/gc/shared/collectedHeap.cpp

Print this page

        

*** 28,40 **** #include "gc/shared/barrierSet.inline.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/collectedHeap.inline.hpp" #include "gc/shared/gcHeapSummary.hpp" #include "gc/shared/gcTrace.hpp" ! #include "gc/shared/gcTraceTime.hpp" #include "gc/shared/gcWhen.hpp" #include "gc/shared/vmGCOperations.hpp" #include "memory/metaspace.hpp" #include "oops/instanceMirrorKlass.hpp" #include "oops/oop.inline.hpp" #include "runtime/init.hpp" #include "runtime/thread.inline.hpp" --- 28,41 ---- #include "gc/shared/barrierSet.inline.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/collectedHeap.inline.hpp" #include "gc/shared/gcHeapSummary.hpp" #include "gc/shared/gcTrace.hpp" ! #include "gc/shared/gcTraceTime.inline.hpp" #include "gc/shared/gcWhen.hpp" #include "gc/shared/vmGCOperations.hpp" + #include "logging/log.hpp" #include "memory/metaspace.hpp" #include "oops/instanceMirrorKlass.hpp" #include "oops/oop.inline.hpp" #include "runtime/init.hpp" #include "runtime/thread.inline.hpp"
*** 51,61 **** void EventLogBase<GCMessage>::print(outputStream* st, GCMessage& m) { st->print_cr("GC heap %s", m.is_before ? "before" : "after"); st->print_raw(m); } ! void GCHeapLog::log_heap(bool before) { if (!should_log()) { return; } double timestamp = fetch_timestamp(); --- 52,62 ---- void EventLogBase<GCMessage>::print(outputStream* st, GCMessage& m) { st->print_cr("GC heap %s", m.is_before ? "before" : "after"); st->print_raw(m); } ! void GCHeapLog::log_heap(CollectedHeap* heap, bool before) { if (!should_log()) { return; } double timestamp = fetch_timestamp();
*** 63,77 **** int index = compute_log_index(); _records[index].thread = NULL; // Its the GC thread so it's not that interesting. _records[index].timestamp = timestamp; _records[index].data.is_before = before; stringStream st(_records[index].data.buffer(), _records[index].data.size()); ! if (before) { ! Universe::print_heap_before_gc(&st, true); ! } else { ! Universe::print_heap_after_gc(&st, true); ! } } VirtualSpaceSummary CollectedHeap::create_heap_space_summary() { size_t capacity_in_words = capacity() / HeapWordSize; --- 64,81 ---- int index = compute_log_index(); _records[index].thread = NULL; // Its the GC thread so it's not that interesting. _records[index].timestamp = timestamp; _records[index].data.is_before = before; stringStream st(_records[index].data.buffer(), _records[index].data.size()); ! ! st.print_cr("{Heap %s GC invocations=%u (full %u):", ! before ? "before" : "after", ! heap->total_collections(), ! heap->total_full_collections()); ! ! heap->print_on(&st); ! st.print_cr("}"); } VirtualSpaceSummary CollectedHeap::create_heap_space_summary() { size_t capacity_in_words = capacity() / HeapWordSize;
*** 106,129 **** return MetaspaceSummary(MetaspaceGC::capacity_until_GC(), meta_space, data_space, class_space, ms_chunk_free_list_summary, class_chunk_free_list_summary); } void CollectedHeap::print_heap_before_gc() { - if (PrintHeapAtGC) { Universe::print_heap_before_gc(); - } if (_gc_heap_log != NULL) { ! _gc_heap_log->log_heap_before(); } } void CollectedHeap::print_heap_after_gc() { - if (PrintHeapAtGC) { Universe::print_heap_after_gc(); - } if (_gc_heap_log != NULL) { ! _gc_heap_log->log_heap_after(); } } void CollectedHeap::print_on_error(outputStream* st) const { st->print_cr("Heap:"); --- 110,129 ---- return MetaspaceSummary(MetaspaceGC::capacity_until_GC(), meta_space, data_space, class_space, ms_chunk_free_list_summary, class_chunk_free_list_summary); } void CollectedHeap::print_heap_before_gc() { Universe::print_heap_before_gc(); if (_gc_heap_log != NULL) { ! _gc_heap_log->log_heap_before(this); } } void CollectedHeap::print_heap_after_gc() { Universe::print_heap_after_gc(); if (_gc_heap_log != NULL) { ! _gc_heap_log->log_heap_after(this); } } void CollectedHeap::print_on_error(outputStream* st) const { st->print_cr("Heap:");
*** 569,606 **** ThreadLocalAllocBuffer::resize_all_tlabs(); } } ! void CollectedHeap::pre_full_gc_dump(GCTimer* timer) { ! if (HeapDumpBeforeFullGC) { GCIdMarkAndRestore gc_id_mark; ! GCTraceTime tt("Heap Dump (before full gc): ", PrintGCDetails, false, timer); ! // We are doing a full collection and a heap dump before ! // full collection has been requested. HeapDumper::dump_heap(); } ! if (PrintClassHistogramBeforeFullGC) { GCIdMarkAndRestore gc_id_mark; ! GCTraceTime tt("Class Histogram (before full gc): ", PrintGCDetails, true, timer); ! VM_GC_HeapInspection inspector(gclog_or_tty, false /* ! full gc */); inspector.doit(); } } void CollectedHeap::post_full_gc_dump(GCTimer* timer) { ! if (HeapDumpAfterFullGC) { ! GCIdMarkAndRestore gc_id_mark; ! GCTraceTime tt("Heap Dump (after full gc): ", PrintGCDetails, false, timer); ! HeapDumper::dump_heap(); ! } ! if (PrintClassHistogramAfterFullGC) { ! GCIdMarkAndRestore gc_id_mark; ! GCTraceTime tt("Class Histogram (after full gc): ", PrintGCDetails, true, timer); ! VM_GC_HeapInspection inspector(gclog_or_tty, false /* ! full gc */); ! inspector.doit(); ! } } void CollectedHeap::initialize_reserved_region(HeapWord *start, HeapWord *end) { // It is important to do this in a way such that concurrent readers can't // temporarily think something is in the heap. (Seen this happen in asserts.) --- 569,602 ---- ThreadLocalAllocBuffer::resize_all_tlabs(); } } ! void CollectedHeap::full_gc_dump(GCTimer* timer, const char* when) { ! if (HeapDumpBeforeFullGC || HeapDumpAfterFullGC) { GCIdMarkAndRestore gc_id_mark; ! FormatBuffer<> title("Heap Dump (%s full gc)", when); ! GCTraceTime(Info, gc) tm(title.buffer(), timer); HeapDumper::dump_heap(); } ! LogHandle(gc, classhisto) log; ! if (log.is_trace()) { ! ResourceMark rm; GCIdMarkAndRestore gc_id_mark; ! FormatBuffer<> title("Class Histogram (%s full gc)", when); ! GCTraceTime(Trace, gc, classhisto) tm(title.buffer(), timer); ! VM_GC_HeapInspection inspector(log.trace_stream(), false /* ! full gc */); inspector.doit(); } } + void CollectedHeap::pre_full_gc_dump(GCTimer* timer) { + full_gc_dump(timer, "before"); + } + void CollectedHeap::post_full_gc_dump(GCTimer* timer) { ! full_gc_dump(timer, "after"); } void CollectedHeap::initialize_reserved_region(HeapWord *start, HeapWord *end) { // It is important to do this in a way such that concurrent readers can't // temporarily think something is in the heap. (Seen this happen in asserts.)
< prev index next >