src/share/vm/runtime/sweeper.cpp
Print this page
@@ -36,10 +36,11 @@
#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__)
@@ -140,14 +141,14 @@
jint NMethodSweeper::_locked_seen = 0;
jint NMethodSweeper::_not_entrant_seen_on_stack = 0;
bool NMethodSweeper::_request_mark_phase = false;
int NMethodSweeper::_total_nof_methods_reclaimed = 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;
+Tickspan NMethodSweeper::_total_time_sweeping;
+Tickspan NMethodSweeper::_total_time_this_sweep;
+Tickspan NMethodSweeper::_peak_sweep_time;
+Tickspan NMethodSweeper::_peak_sweep_fraction_time;
int NMethodSweeper::_hotness_counter_reset_val = 0;
class MarkActivationClosure: public CodeBlobClosure {
public:
@@ -202,11 +203,11 @@
if (!sweep_in_progress() && need_marking_phase()) {
_seen = 0;
_invocations = NmethodSweepFraction;
_current = CodeCache::first_nmethod();
_traversals += 1;
- _total_time_this_sweep = 0;
+ _total_time_this_sweep = Tickspan();
if (PrintMethodFlushing) {
tty->print_cr("### Sweep: stack traversal %d", _traversals);
}
Threads::nmethods_do(&mark_activation_closure);
@@ -250,11 +251,11 @@
}
}
void NMethodSweeper::sweep_code_cache() {
- jlong sweep_start_counter = os::elapsed_counter();
+ const Ticks sweep_start_counter = Ticks::now();
_flushed_count = 0;
_zombified_count = 0;
_marked_count = 0;
@@ -326,12 +327,12 @@
if (PrintMethodFlushing) {
tty->print_cr("### Couldn't make progress on some nmethods so stopping sweep");
}
}
- jlong sweep_end_counter = os::elapsed_counter();
- jlong sweep_time = sweep_end_counter - sweep_start_counter;
+ 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;
@@ -348,11 +349,11 @@
event.commit();
}
#ifdef ASSERT
if(PrintMethodFlushing) {
- tty->print_cr("### sweeper: sweep time(%d): " INT64_FORMAT, _invocations, (jlong)sweep_time);
+ tty->print_cr("### sweeper: sweep time(%d): " INT64_FORMAT, _invocations, sweep_time.value());
}
#endif
if (_invocations == 1) {
_peak_sweep_time = MAX2(_peak_sweep_time, _total_time_this_sweep);