--- old/src/share/vm/runtime/sweeper.cpp 2013-09-27 16:07:11.414198838 +0200 +++ new/src/share/vm/runtime/sweeper.cpp 2013-09-27 16:07:11.370198616 +0200 @@ -132,6 +132,7 @@ nmethod* NMethodSweeper::_current = NULL; // Current nmethod int NMethodSweeper::_seen = 0 ; // No. of nmethods we have currently processed in current pass of CodeCache int NMethodSweeper::_flushed_count = 0; // Nof. nmethods flushed in current sweep +size_t NMethodSweeper::_flushed_size = 0; // Total size of nmethods flushed in current sweep int NMethodSweeper::_zombified_count = 0; // Nof. nmethods made zombie in current sweep int NMethodSweeper::_marked_count = 0; // Nof. nmethods marked for reclaim in current sweep @@ -149,6 +150,7 @@ int NMethodSweeper::_number_of_flushes = 0; // Total of full traversals caused by full cache int NMethodSweeper::_total_nof_methods_reclaimed = 0; +size_t NMethodSweeper::_total_flushed_size = 0; jlong NMethodSweeper::_total_time_sweeping = 0; jlong NMethodSweeper::_total_time_this_sweep = 0; jlong NMethodSweeper::_peak_sweep_time = 0; @@ -248,6 +250,7 @@ jlong sweep_start_counter = os::elapsed_counter(); _flushed_count = 0; + _flushed_size = 0; _zombified_count = 0; _marked_count = 0; @@ -325,6 +328,7 @@ _total_time_sweeping += sweep_time; _total_time_this_sweep += sweep_time; _peak_sweep_fraction_time = MAX2(sweep_time, _peak_sweep_fraction_time); + _total_flushed_size += _flushed_size; _total_nof_methods_reclaimed += _flushed_count; EventSweepCodeCache event(UNTIMED); @@ -425,6 +429,7 @@ if (PrintMethodFlushing && Verbose) { tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (marked for reclamation) being flushed", nm->compile_id(), nm); } + _flushed_size += nm->size(); release_nmethod(nm); _flushed_count++; } else { @@ -465,6 +470,7 @@ if (nm->is_osr_method()) { SWEEP(nm); // No inline caches will ever point to osr methods, so we can just remove it + _flushed_size += nm->size(); release_nmethod(nm); _flushed_count++; } else { @@ -651,3 +657,14 @@ xtty->end_elem(); } } + +void NMethodSweeper::print() { + ttyLocker ttyl; + tty->print_cr("Method flushing statistics:"); + tty->print_cr(" Total sweep time: %1.3lfms", (double)_total_time_sweeping/1000); + tty->print_cr(" Peak sweep time: %1.3lfms", (double)_peak_sweep_time/1000); + tty->print_cr(" Peak sweep fraction time: %1.3lfms", (double)_peak_sweep_fraction_time/1000); + tty->print_cr(" Total number of stack traversals: %d", _traversals); + tty->print_cr(" Total number of flushed methods: %d", _total_nof_methods_reclaimed); + tty->print_cr(" Total size of flushed methods: " SIZE_FORMAT "Kb", _total_flushed_size/K); +}