src/share/vm/runtime/sweeper.cpp
Print this page
rev 5685 : 8028128: Add a type safe alternative for working with counter based data
Reviewed-by:
*** 36,45 ****
--- 36,46 ----
#include "runtime/os.hpp"
#include "runtime/sweeper.hpp"
#include "runtime/vm_operations.hpp"
#include "trace/tracing.hpp"
#include "utilities/events.hpp"
+ #include "utilities/ticks.inline.hpp"
#include "utilities/xmlstream.hpp"
#ifdef ASSERT
#define SWEEP(nm) record_sweep(nm, __LINE__)
*** 142,155 ****
// 1) alive -> not_entrant
// 2) not_entrant -> zombie
// 3) zombie -> marked_for_reclamation
int NMethodSweeper::_total_nof_methods_reclaimed = 0; // Accumulated nof methods flushed
! jlong NMethodSweeper::_total_time_sweeping = 0; // Accumulated time sweeping
! jlong NMethodSweeper::_total_time_this_sweep = 0; // Total time this sweep
! jlong NMethodSweeper::_peak_sweep_time = 0; // Peak time for a full sweep
! jlong NMethodSweeper::_peak_sweep_fraction_time = 0; // Peak time sweeping one fraction
int NMethodSweeper::_hotness_counter_reset_val = 0;
class MarkActivationClosure: public CodeBlobClosure {
public:
--- 143,156 ----
// 1) alive -> not_entrant
// 2) not_entrant -> zombie
// 3) zombie -> marked_for_reclamation
int NMethodSweeper::_total_nof_methods_reclaimed = 0; // Accumulated nof methods flushed
! Tickspan NMethodSweeper::_total_time_sweeping; // Accumulated time sweeping
! Tickspan NMethodSweeper::_total_time_this_sweep; // Total time this sweep
! Tickspan NMethodSweeper::_peak_sweep_time; // Peak time for a full sweep
! Tickspan NMethodSweeper::_peak_sweep_fraction_time; // Peak time sweeping one fraction
int NMethodSweeper::_hotness_counter_reset_val = 0;
class MarkActivationClosure: public CodeBlobClosure {
public:
*** 207,217 ****
if (!sweep_in_progress()) {
_seen = 0;
_sweep_fractions_left = NmethodSweepFraction;
_current = CodeCache::first_nmethod();
_traversals += 1;
! _total_time_this_sweep = 0;
if (PrintMethodFlushing) {
tty->print_cr("### Sweep: stack traversal %d", _traversals);
}
Threads::nmethods_do(&mark_activation_closure);
--- 208,218 ----
if (!sweep_in_progress()) {
_seen = 0;
_sweep_fractions_left = NmethodSweepFraction;
_current = CodeCache::first_nmethod();
_traversals += 1;
! _total_time_this_sweep = Tickspan();
if (PrintMethodFlushing) {
tty->print_cr("### Sweep: stack traversal %d", _traversals);
}
Threads::nmethods_do(&mark_activation_closure);
*** 300,310 ****
_sweep_started = 0;
}
}
void NMethodSweeper::sweep_code_cache() {
! jlong sweep_start_counter = os::elapsed_counter();
_flushed_count = 0;
_zombified_count = 0;
_marked_for_reclamation_count = 0;
--- 301,311 ----
_sweep_started = 0;
}
}
void NMethodSweeper::sweep_code_cache() {
! Ticks sweep_start_counter = Ticks::now();
_flushed_count = 0;
_zombified_count = 0;
_marked_for_reclamation_count = 0;
*** 364,375 ****
}
}
assert(_sweep_fractions_left > 1 || _current == NULL, "must have scanned the whole cache");
! 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_nof_methods_reclaimed += _flushed_count;
--- 365,376 ----
}
}
assert(_sweep_fractions_left > 1 || _current == NULL, "must have scanned the whole cache");
! const Ticks sweep_end_counter = Ticks::now();
! const Tickspan 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_nof_methods_reclaimed += _flushed_count;
*** 386,396 ****
event.commit();
}
#ifdef ASSERT
if(PrintMethodFlushing) {
! tty->print_cr("### sweeper: sweep time(%d): " INT64_FORMAT, _sweep_fractions_left, (jlong)sweep_time);
}
#endif
if (_sweep_fractions_left == 1) {
_peak_sweep_time = MAX2(_peak_sweep_time, _total_time_this_sweep);
--- 387,398 ----
event.commit();
}
#ifdef ASSERT
if(PrintMethodFlushing) {
! tty->print_cr("### sweeper: sweep time(%d): "
! INT64_FORMAT, _sweep_fractions_left, (jlong)sweep_time.value());
}
#endif
if (_sweep_fractions_left == 1) {
_peak_sweep_time = MAX2(_peak_sweep_time, _total_time_this_sweep);