diff src/share/vm/runtime/sweeper.cpp @ 14442:1174c8abbdb6

Merge
author kvn
date Thu, 05 Dec 2013 15:13:12 -0800
parents 86e6d691f2e1
children 02f27ecb4f3a d49557091d18 3205e78d8193
line wrap: on
line diff
--- a/src/share/vm/runtime/sweeper.cpp	Thu Dec 05 19:19:09 2013 +0100
+++ b/src/share/vm/runtime/sweeper.cpp	Thu Dec 05 15:13:12 2013 -0800
@@ -38,6 +38,7 @@
 #include "runtime/vm_operations.hpp"
 #include "trace/tracing.hpp"
 #include "utilities/events.hpp"
+#include "utilities/ticks.inline.hpp"
 #include "utilities/xmlstream.hpp"
 
 #ifdef ASSERT
@@ -144,10 +145,10 @@
                                                                //   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
+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;
 
 
@@ -209,7 +210,7 @@
     _sweep_fractions_left = 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);
@@ -231,7 +232,8 @@
  */
 void NMethodSweeper::possibly_sweep() {
   assert(JavaThread::current()->thread_state() == _thread_in_vm, "must run in vm mode");
-  if (!MethodFlushing || !sweep_in_progress()) {
+  // Only compiler threads are allowed to sweep
+  if (!MethodFlushing || !sweep_in_progress() || !Thread::current()->is_Compiler_thread()) {
     return;
   }
 
@@ -302,7 +304,7 @@
 }
 
 void NMethodSweeper::sweep_code_cache() {
-  jlong sweep_start_counter = os::elapsed_counter();
+  Ticks sweep_start_counter = Ticks::now();
 
   _flushed_count                = 0;
   _zombified_count              = 0;
@@ -366,8 +368,8 @@
 
   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;
+  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);
@@ -388,7 +390,8 @@
 
 #ifdef ASSERT
   if(PrintMethodFlushing) {
-    tty->print_cr("### sweeper:      sweep time(%d): " INT64_FORMAT, _sweep_fractions_left, (jlong)sweep_time);
+    tty->print_cr("### sweeper:      sweep time(%d): "
+      INT64_FORMAT, _sweep_fractions_left, (jlong)sweep_time.value());
   }
 #endif