src/share/vm/runtime/sweeper.cpp
Print this page
*** 130,139 ****
--- 130,140 ----
long NMethodSweeper::_traversals = 0; // No. of stack traversals performed
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
volatile int NMethodSweeper::_invocations = 0; // No. of invocations left until we are completed with this pass
volatile int NMethodSweeper::_sweep_started = 0; // Whether a sweep is in progress.
*** 147,156 ****
--- 148,158 ----
int NMethodSweeper::_dead_compile_ids = 0;
long NMethodSweeper::_last_flush_traversal_id = 0;
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;
jlong NMethodSweeper::_peak_sweep_fraction_time = 0;
jlong NMethodSweeper::_total_disconnect_time = 0;
*** 246,255 ****
--- 248,258 ----
void NMethodSweeper::sweep_code_cache() {
jlong sweep_start_counter = os::elapsed_counter();
_flushed_count = 0;
+ _flushed_size = 0;
_zombified_count = 0;
_marked_count = 0;
if (PrintMethodFlushing && Verbose) {
tty->print_cr("### Sweep at %d out of %d. Invocations left: %d", _seen, CodeCache::nof_nmethods(), _invocations);
*** 323,332 ****
--- 326,336 ----
jlong sweep_end_counter = os::elapsed_counter();
jlong sweep_time = sweep_end_counter - sweep_start_counter;
_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);
if (event.should_commit()) {
event.set_starttime(sweep_start_counter);
*** 423,432 ****
--- 427,437 ----
if (nm->is_marked_for_reclamation()) {
assert(!nm->is_locked_by_vm(), "must not flush locked nmethods");
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 {
if (PrintMethodFlushing && Verbose) {
tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (zombie) being marked for reclamation", nm->compile_id(), nm);
*** 463,472 ****
--- 468,478 ----
tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (unloaded) being made zombie", nm->compile_id(), nm);
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 {
nm->make_zombie();
_resweep = true;
*** 649,653 ****
--- 655,670 ----
xtty->print(s.as_string());
xtty->stamp();
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);
+ }