changeset 4209:7ffe30a79778

8008208: Event tracing for code cache subsystems can give wrong timestamps Reviewed-by: kvn, sla
author mgronlun
date Thu, 14 Feb 2013 18:47:28 +0100
parents 6a71d443bd0a
children 6a431dbf4a33
files src/share/vm/opto/compile.hpp src/share/vm/runtime/sweeper.cpp src/share/vm/runtime/sweeper.hpp
diffstat 3 files changed, 29 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/opto/compile.hpp	Thu Feb 14 13:08:15 2013 +0100
+++ b/src/share/vm/opto/compile.hpp	Thu Feb 14 18:47:28 2013 +0100
@@ -542,7 +542,7 @@
   bool              has_method_handle_invokes() const { return _has_method_handle_invokes;     }
   void          set_has_method_handle_invokes(bool z) {        _has_method_handle_invokes = z; }
 
-  long _latest_stage_start_counter;
+  jlong _latest_stage_start_counter;
 
   void begin_method() {
 #ifndef PRODUCT
--- a/src/share/vm/runtime/sweeper.cpp	Thu Feb 14 13:08:15 2013 +0100
+++ b/src/share/vm/runtime/sweeper.cpp	Thu Feb 14 18:47:28 2013 +0100
@@ -148,12 +148,12 @@
 
 int       NMethodSweeper::_number_of_flushes = 0; // Total of full traversals caused by full cache
 int       NMethodSweeper::_total_nof_methods_reclaimed = 0;
-long      NMethodSweeper::_total_time_sweeping = 0;
-long      NMethodSweeper::_total_time_this_sweep = 0;
-long      NMethodSweeper::_peak_sweep_time = 0;
-long      NMethodSweeper::_peak_sweep_fraction_time = 0;
-long      NMethodSweeper::_total_disconnect_time = 0;
-long      NMethodSweeper::_peak_disconnect_time = 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;
+jlong     NMethodSweeper::_peak_disconnect_time = 0;
 
 class MarkActivationClosure: public CodeBlobClosure {
 public:
@@ -257,9 +257,7 @@
 
 void NMethodSweeper::sweep_code_cache() {
 
-  long sweep_start_counter, sweep_end_counter;
-  long sweep_time;
-  sweep_start_counter = os::elapsed_counter();
+  jlong sweep_start_counter = os::elapsed_counter();
 
   _flushed_count   = 0;
   _zombified_count = 0;
@@ -324,8 +322,8 @@
     }
   }
 
-  sweep_end_counter = os::elapsed_counter();
-  sweep_time = sweep_end_counter - sweep_start_counter;
+  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);
@@ -523,10 +521,6 @@
   // If there was a race in detecting full code cache, only run
   // one vm op for it or keep the compiler shut off
 
-  long disconnect_start_counter;
-  long disconnect_end_counter;
-  long disconnect_time;
-
   if ((!was_full()) && (is_full)) {
     if (!CodeCache::needs_flushing()) {
       log_sweep("restart_compiler");
@@ -535,7 +529,7 @@
     }
   }
 
-  disconnect_start_counter = os::elapsed_counter();
+  jlong disconnect_start_counter = os::elapsed_counter();
 
   // Traverse the code cache trying to dump the oldest nmethods
   uint curr_max_comp_id = CompileBroker::get_compilation_id();
@@ -583,8 +577,8 @@
     CompileBroker::set_should_compile_new_jobs(CompileBroker::stop_compilation);
   }
 
-  disconnect_end_counter = os::elapsed_counter();
-  disconnect_time = disconnect_end_counter - disconnect_start_counter;
+  jlong disconnect_end_counter = os::elapsed_counter();
+  jlong disconnect_time = disconnect_end_counter - disconnect_start_counter;
   _total_disconnect_time += disconnect_time;
   _peak_disconnect_time = MAX2(disconnect_time, _peak_disconnect_time);
 
--- a/src/share/vm/runtime/sweeper.hpp	Thu Feb 14 13:08:15 2013 +0100
+++ b/src/share/vm/runtime/sweeper.hpp	Thu Feb 14 18:47:28 2013 +0100
@@ -54,28 +54,28 @@
   static long      _was_full_traversal;   // trav number at last emergency unloading
 
   // Stat counters
-  static int       _number_of_flushes;           // Total of full traversals caused by full cache
-  static int       _total_nof_methods_reclaimed; // Accumulated nof methods flushed
-  static long      _total_time_sweeping;         // Accumulated time sweeping
-  static long      _total_time_this_sweep;       // Total time this sweep
-  static long      _peak_sweep_time;             // Peak time for a full sweep
-  static long      _peak_sweep_fraction_time;    // Peak time sweeping one fraction
-  static long      _total_disconnect_time;       // Total time cleaning code mem
-  static long      _peak_disconnect_time;        // Peak time cleaning code mem
+  static int       _number_of_flushes;            // Total of full traversals caused by full cache
+  static int       _total_nof_methods_reclaimed;  // Accumulated nof methods flushed
+  static jlong     _total_time_sweeping;          // Accumulated time sweeping
+  static jlong     _total_time_this_sweep;        // Total time this sweep
+  static jlong     _peak_sweep_time;              // Peak time for a full sweep
+  static jlong     _peak_sweep_fraction_time;     // Peak time sweeping one fraction
+  static jlong     _total_disconnect_time;        // Total time cleaning code mem
+  static jlong     _peak_disconnect_time;         // Peak time cleaning code mem
 
   static void process_nmethod(nmethod *nm);
 
   static void log_sweep(const char* msg, const char* format = NULL, ...);
 
  public:
-  static long traversal_count()             { return _traversals; }
-  static int  number_of_flushes()           { return _number_of_flushes; }
-  static int  total_nof_methods_reclaimed() { return _total_nof_methods_reclaimed; }
-  static long total_time_sweeping()         { return _total_time_sweeping; }
-  static long peak_sweep_time()             { return _peak_sweep_time; }
-  static long peak_sweep_fraction_time()    { return _peak_sweep_fraction_time; }
-  static long total_disconnect_time()       { return _total_disconnect_time; }
-  static long peak_disconnect_time()        { return _peak_disconnect_time; }
+  static long traversal_count()              { return _traversals; }
+  static int  number_of_flushes()            { return _number_of_flushes; }
+  static int  total_nof_methods_reclaimed()  { return _total_nof_methods_reclaimed; }
+  static jlong total_time_sweeping()         { return _total_time_sweeping; }
+  static jlong peak_sweep_time()             { return _peak_sweep_time; }
+  static jlong peak_sweep_fraction_time()    { return _peak_sweep_fraction_time; }
+  static jlong total_disconnect_time()       { return _total_disconnect_time; }
+  static jlong peak_disconnect_time()        { return _peak_disconnect_time; }
 
 #ifdef ASSERT
   // Keep track of sweeper activity in the ring buffer