src/share/vm/runtime/sweeper.cpp
Print this page
@@ -130,10 +130,11 @@
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,10 +148,11 @@
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,10 +248,11 @@
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,10 +326,11 @@
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,10 +427,11 @@
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,10 +468,11 @@
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,5 +655,16 @@
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);
+}