--- old/src/hotspot/share/memory/metaspace.cpp 2018-04-30 17:17:52.351150300 +0200 +++ new/src/hotspot/share/memory/metaspace.cpp 2018-04-30 17:17:52.271149631 +0200 @@ -4086,22 +4086,32 @@ // For all wastages, print percentages from total. As total use the total size of memory committed for metaspace. const size_t committed_words = committed_bytes() / BytesPerWord; - out->print("(Percentage values refer to total committed size ("); + out->print("Percentage values refer to total committed size "); print_scaled_words(out, committed_words, scale); out->print_cr(")."); + // Print space committed but not yet used by any class loader + const size_t unused_words_in_vs = MetaspaceUtils::free_in_vs_bytes() / BytesPerWord; + out->print(" Committed unused: "); + print_scaled_words_and_percentage(out, unused_words_in_vs, committed_words, scale, 6); + out->cr(); + // Print waste for in-use chunks. UsedChunksStatistics ucs_nonclass = cl._stats_total.nonclass_sm_stats().totals(); UsedChunksStatistics ucs_class = cl._stats_total.class_sm_stats().totals(); UsedChunksStatistics ucs_all; ucs_all.add(ucs_nonclass); ucs_all.add(ucs_class); + out->print(" Waste in chunks in use: "); print_scaled_words_and_percentage(out, ucs_all.waste(), committed_words, scale, 6); out->cr(); out->print(" Free in chunks in use: "); print_scaled_words_and_percentage(out, ucs_all.free(), committed_words, scale, 6); out->cr(); + out->print(" Overhead in chunks in use: "); + print_scaled_words_and_percentage(out, ucs_all.overhead(), committed_words, scale, 6); + out->cr(); // Print waste in free chunks. const size_t total_capacity_in_free_chunks = @@ -4118,8 +4128,16 @@ const size_t free_blocks_cap_words = cl._stats_total.nonclass_sm_stats().free_blocks_cap_words() + cl._stats_total.class_sm_stats().free_blocks_cap_words(); - out->print("Deallocated from chunks in use: " UINTX_FORMAT " blocks, total size ", free_blocks_num); + out->print("Deallocated from chunks in use: "); print_scaled_words_and_percentage(out, free_blocks_cap_words, committed_words, scale, 6); + out->print(" ("UINTX_FORMAT " blocks)", free_blocks_num); + out->cr(); + + // Print total waste. + const size_t total_waste = ucs_all.waste() + ucs_all.free() + ucs_all.overhead() + total_capacity_in_free_chunks + + free_blocks_cap_words + unused_words_in_vs; + out->print(" -total-: "); + print_scaled_words_and_percentage(out, total_waste, committed_words, scale, 6); out->cr(); // Print internal statistics