< prev index next >

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

Print this page

        

*** 38,79 **** _metaspace_used_bytes = MetaspaceAux::used_bytes(); } G1HeapTransition::G1HeapTransition(G1CollectedHeap* g1_heap) : _g1_heap(g1_heap), _before(g1_heap) { } ! struct SeparatedUsageInfo : public StackObj { size_t _eden_used; size_t _survivor_used; size_t _old_used; size_t _humongous_used; size_t _eden_region_count; size_t _survivor_region_count; size_t _old_region_count; size_t _humongous_region_count; ! SeparatedUsageInfo() : _eden_used(0), _survivor_used(0), _old_used(0), _humongous_used(0), _eden_region_count(0), _survivor_region_count(0), _old_region_count(0), _humongous_region_count(0) {} }; ! class SumSeparatedUsedClosure: public HeapRegionClosure { public: ! SeparatedUsageInfo _info; bool doHeapRegion(HeapRegion* r) { if (r->is_old()) { ! _info._old_used += r->used(); ! _info._old_region_count++; } else if (r->is_survivor()) { ! _info._survivor_used += r->used(); ! _info._survivor_region_count++; } else if (r->is_eden()) { ! _info._eden_used += r->used(); ! _info._eden_region_count++; } else if (r->is_humongous()) { ! _info._humongous_used += r->used(); ! _info._humongous_region_count++; } else { assert(r->used() == 0, "Expected used to be 0 but it was " SIZE_FORMAT, r->used()); } return false; } --- 38,79 ---- _metaspace_used_bytes = MetaspaceAux::used_bytes(); } G1HeapTransition::G1HeapTransition(G1CollectedHeap* g1_heap) : _g1_heap(g1_heap), _before(g1_heap) { } ! struct DetailedUsage : public StackObj { size_t _eden_used; size_t _survivor_used; size_t _old_used; size_t _humongous_used; size_t _eden_region_count; size_t _survivor_region_count; size_t _old_region_count; size_t _humongous_region_count; ! DetailedUsage() : _eden_used(0), _survivor_used(0), _old_used(0), _humongous_used(0), _eden_region_count(0), _survivor_region_count(0), _old_region_count(0), _humongous_region_count(0) {} }; ! class DetailedUsageClosure: public HeapRegionClosure { public: ! DetailedUsage _usage; bool doHeapRegion(HeapRegion* r) { if (r->is_old()) { ! _usage._old_used += r->used(); ! _usage._old_region_count++; } else if (r->is_survivor()) { ! _usage._survivor_used += r->used(); ! _usage._survivor_region_count++; } else if (r->is_eden()) { ! _usage._eden_used += r->used(); ! _usage._eden_region_count++; } else if (r->is_humongous()) { ! _usage._humongous_used += r->used(); ! _usage._humongous_region_count++; } else { assert(r->used() == 0, "Expected used to be 0 but it was " SIZE_FORMAT, r->used()); } return false; }
*** 83,122 **** Data after(_g1_heap); size_t eden_capacity_bytes_after_gc = _g1_heap->g1_policy()->young_list_target_length() - after._survivor_length; size_t survivor_capacity_bytes_after_gc = _g1_heap->g1_policy()->max_survivor_regions(); ! SeparatedUsageInfo usage_info; if (log_is_enabled(Trace, gc, heap)) { ! SumSeparatedUsedClosure blk; _g1_heap->heap_region_iterate(&blk); ! usage_info = blk._info; ! assert(usage_info._eden_region_count == 0, "Expected no eden regions, but got " SIZE_FORMAT, usage_info._eden_region_count); ! assert(usage_info._survivor_region_count == after._survivor_length, "Expected survivors to be " SIZE_FORMAT " but was " SIZE_FORMAT, ! after._survivor_length, usage_info._survivor_region_count); ! assert(usage_info._old_region_count == after._old_length, "Expected old to be " SIZE_FORMAT " but was " SIZE_FORMAT, ! after._old_length, usage_info._old_region_count); ! assert(usage_info._humongous_region_count == after._humongous_length, "Expected humongous to be " SIZE_FORMAT " but was " SIZE_FORMAT, ! after._humongous_length, usage_info._humongous_region_count); } log_info(gc, heap)("Eden regions: " SIZE_FORMAT "->" SIZE_FORMAT "(" SIZE_FORMAT ")", _before._eden_length, after._eden_length, eden_capacity_bytes_after_gc); log_trace(gc, heap)(" Used: 0K, Waste: 0K"); log_info(gc, heap)("Survivor regions: " SIZE_FORMAT "->" SIZE_FORMAT "(" SIZE_FORMAT ")", _before._survivor_length, after._survivor_length, survivor_capacity_bytes_after_gc); log_trace(gc, heap)(" Used: " SIZE_FORMAT "K, Waste: " SIZE_FORMAT "K", ! usage_info._survivor_used / K, ((after._survivor_length * HeapRegion::GrainBytes) - usage_info._survivor_used) / K); log_info(gc, heap)("Old regions: " SIZE_FORMAT "->" SIZE_FORMAT, _before._old_length, after._old_length); log_trace(gc, heap)(" Used: " SIZE_FORMAT "K, Waste: " SIZE_FORMAT "K", ! usage_info._old_used / K, ((after._old_length * HeapRegion::GrainBytes) - usage_info._old_used) / K); log_info(gc, heap)("Humongous regions: " SIZE_FORMAT "->" SIZE_FORMAT, _before._humongous_length, after._humongous_length); log_trace(gc, heap)(" Used: " SIZE_FORMAT "K, Waste: " SIZE_FORMAT "K", ! usage_info._humongous_used / K, ((after._humongous_length * HeapRegion::GrainBytes) - usage_info._humongous_used) / K); MetaspaceAux::print_metaspace_change(_before._metaspace_used_bytes); } --- 83,122 ---- Data after(_g1_heap); size_t eden_capacity_bytes_after_gc = _g1_heap->g1_policy()->young_list_target_length() - after._survivor_length; size_t survivor_capacity_bytes_after_gc = _g1_heap->g1_policy()->max_survivor_regions(); ! DetailedUsage usage; if (log_is_enabled(Trace, gc, heap)) { ! DetailedUsageClosure blk; _g1_heap->heap_region_iterate(&blk); ! usage = blk._usage; ! assert(usage._eden_region_count == 0, "Expected no eden regions, but got " SIZE_FORMAT, usage._eden_region_count); ! assert(usage._survivor_region_count == after._survivor_length, "Expected survivors to be " SIZE_FORMAT " but was " SIZE_FORMAT, ! after._survivor_length, usage._survivor_region_count); ! assert(usage._old_region_count == after._old_length, "Expected old to be " SIZE_FORMAT " but was " SIZE_FORMAT, ! after._old_length, usage._old_region_count); ! assert(usage._humongous_region_count == after._humongous_length, "Expected humongous to be " SIZE_FORMAT " but was " SIZE_FORMAT, ! after._humongous_length, usage._humongous_region_count); } log_info(gc, heap)("Eden regions: " SIZE_FORMAT "->" SIZE_FORMAT "(" SIZE_FORMAT ")", _before._eden_length, after._eden_length, eden_capacity_bytes_after_gc); log_trace(gc, heap)(" Used: 0K, Waste: 0K"); log_info(gc, heap)("Survivor regions: " SIZE_FORMAT "->" SIZE_FORMAT "(" SIZE_FORMAT ")", _before._survivor_length, after._survivor_length, survivor_capacity_bytes_after_gc); log_trace(gc, heap)(" Used: " SIZE_FORMAT "K, Waste: " SIZE_FORMAT "K", ! usage._survivor_used / K, ((after._survivor_length * HeapRegion::GrainBytes) - usage._survivor_used) / K); log_info(gc, heap)("Old regions: " SIZE_FORMAT "->" SIZE_FORMAT, _before._old_length, after._old_length); log_trace(gc, heap)(" Used: " SIZE_FORMAT "K, Waste: " SIZE_FORMAT "K", ! usage._old_used / K, ((after._old_length * HeapRegion::GrainBytes) - usage._old_used) / K); log_info(gc, heap)("Humongous regions: " SIZE_FORMAT "->" SIZE_FORMAT, _before._humongous_length, after._humongous_length); log_trace(gc, heap)(" Used: " SIZE_FORMAT "K, Waste: " SIZE_FORMAT "K", ! usage._humongous_used / K, ((after._humongous_length * HeapRegion::GrainBytes) - usage._humongous_used) / K); MetaspaceAux::print_metaspace_change(_before._metaspace_used_bytes); }
< prev index next >