8025608: GC trace events missing nursery size information

Reviewed-by: sjohanss, mgerdin
This commit is contained in:
David Lindholm 2015-06-12 12:55:32 +02:00
parent 2a9614af95
commit c3f3f0f1bd
6 changed files with 68 additions and 0 deletions

View File

@ -3233,6 +3233,28 @@ void G1CollectedHeap::print_all_rsets() {
}
#endif // PRODUCT
G1HeapSummary G1CollectedHeap::create_g1_heap_summary() {
YoungList* young_list = heap()->young_list();
size_t eden_used_bytes = young_list->eden_used_bytes();
size_t survivor_used_bytes = young_list->survivor_used_bytes();
size_t eden_capacity_bytes =
(g1_policy()->young_list_target_length() * HeapRegion::GrainBytes) - survivor_used_bytes;
VirtualSpaceSummary heap_summary = create_heap_space_summary();
return G1HeapSummary(heap_summary, used(), eden_used_bytes, eden_capacity_bytes, survivor_used_bytes);
}
void G1CollectedHeap::trace_heap(GCWhen::Type when, const GCTracer* gc_tracer) {
const G1HeapSummary& heap_summary = create_g1_heap_summary();
gc_tracer->report_gc_heap_summary(when, heap_summary);
const MetaspaceSummary& metaspace_summary = create_metaspace_summary();
gc_tracer->report_metaspace_summary(when, metaspace_summary);
}
G1CollectedHeap* G1CollectedHeap::heap() {
CollectedHeap* heap = Universe::heap();
assert(heap != NULL, "Uninitialized access to G1CollectedHeap::heap()");

View File

@ -370,6 +370,8 @@ private:
void log_gc_header();
void log_gc_footer(double pause_time_sec);
void trace_heap(GCWhen::Type when, const GCTracer* tracer);
// These are macros so that, if the assert fires, we get the correct
// line number, file, etc.
@ -1548,6 +1550,8 @@ public:
bool is_obj_dead_cond(const oop obj,
const VerifyOption vo) const;
G1HeapSummary create_g1_heap_summary();
// Printing
virtual void print_on(outputStream* st) const;

View File

@ -78,11 +78,13 @@ class MetaspaceSizes : public StackObj {
class GCHeapSummary;
class PSHeapSummary;
class G1HeapSummary;
class GCHeapSummaryVisitor {
public:
virtual void visit(const GCHeapSummary* heap_summary) const = 0;
virtual void visit(const PSHeapSummary* heap_summary) const {}
virtual void visit(const G1HeapSummary* heap_summary) const {}
};
class GCHeapSummary : public StackObj {
@ -125,6 +127,22 @@ class PSHeapSummary : public GCHeapSummary {
}
};
class G1HeapSummary : public GCHeapSummary {
size_t _edenUsed;
size_t _edenCapacity;
size_t _survivorUsed;
public:
G1HeapSummary(VirtualSpaceSummary& heap_space, size_t heap_used, size_t edenUsed, size_t edenCapacity, size_t survivorUsed) :
GCHeapSummary(heap_space, heap_used), _edenUsed(edenUsed), _edenCapacity(edenCapacity), _survivorUsed(survivorUsed) { }
const size_t edenUsed() const { return _edenUsed; }
const size_t edenCapacity() const { return _edenCapacity; }
const size_t survivorUsed() const { return _survivorUsed; }
virtual void accept(GCHeapSummaryVisitor* visitor) const {
visitor->visit(this);
}
};
class MetaspaceSummary : public StackObj {
size_t _capacity_until_GC;
MetaspaceSizes _meta_space;

View File

@ -44,6 +44,7 @@ class GCHeapSummary;
class MetaspaceChunkFreeListSummary;
class MetaspaceSummary;
class PSHeapSummary;
class G1HeapSummary;
class ReferenceProcessorStats;
class TimePartitions;
class BoolObjectClosure;

View File

@ -263,6 +263,20 @@ class GCHeapSummaryEventSender : public GCHeapSummaryVisitor {
}
}
void visit(const G1HeapSummary* g1_heap_summary) const {
visit((GCHeapSummary*)g1_heap_summary);
EventG1HeapSummary e;
if (e.should_commit()) {
e.set_gcId(_gc_id.id());
e.set_when((u1)_when);
e.set_edenUsedSize(g1_heap_summary->edenUsed());
e.set_edenTotalSize(g1_heap_summary->edenCapacity());
e.set_survivorUsedSize(g1_heap_summary->survivorUsed());
e.commit();
}
}
void visit(const PSHeapSummary* ps_heap_summary) const {
visit((GCHeapSummary*)ps_heap_summary);

View File

@ -264,6 +264,15 @@ Declares a structure type that can be used in other events.
<structvalue type="ObjectSpace" field="toSpace" label="To Space"/>
</event>
<event id="G1HeapSummary" path="vm/gc/heap/g1_summary" label="G1 Heap Summary" is_instant="true">
<value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
<value type="GCWHEN" field="when" label="When" />
<value type="BYTES64" field="edenUsedSize" label="Eden Used Size" />
<value type="BYTES64" field="edenTotalSize" label="Eden Total Size" />
<value type="BYTES64" field="survivorUsedSize" label="Survivor Used Size" />
</event>
<event id="GCGarbageCollection" path="vm/gc/collector/garbage_collection" label="Garbage Collection"
description="Garbage collection performed by the JVM">
<value type="UINT" field="gcId" label="GC ID" relation="GC_ID" />