src/share/vm/runtime/sweeper.cpp

changeset 6207
6aa49042b101
parent 6205
908afcc9d1cb
child 6503
a9becfeecd1b
     1.1 --- a/src/share/vm/runtime/sweeper.cpp	Thu Dec 19 06:09:16 2013 +0100
     1.2 +++ b/src/share/vm/runtime/sweeper.cpp	Thu Dec 19 14:08:02 2013 +0100
     1.3 @@ -129,6 +129,7 @@
     1.4  
     1.5  nmethod* NMethodSweeper::_current                      = NULL; // Current nmethod
     1.6  long     NMethodSweeper::_traversals                   = 0;    // Stack scan count, also sweep ID.
     1.7 +long     NMethodSweeper::_total_nof_code_cache_sweeps  = 0;    // Total number of full sweeps of the code cache
     1.8  long     NMethodSweeper::_time_counter                 = 0;    // Virtual time used to periodically invoke sweeper
     1.9  long     NMethodSweeper::_last_sweep                   = 0;    // Value of _time_counter when the last sweep happened
    1.10  int      NMethodSweeper::_seen                         = 0;    // Nof. nmethod we have currently processed in current pass of CodeCache
    1.11 @@ -143,13 +144,16 @@
    1.12                                                                 //   1) alive       -> not_entrant
    1.13                                                                 //   2) not_entrant -> zombie
    1.14                                                                 //   3) zombie      -> marked_for_reclamation
    1.15 +int    NMethodSweeper::_hotness_counter_reset_val       = 0;
    1.16  
    1.17 -int   NMethodSweeper::_total_nof_methods_reclaimed     = 0;    // Accumulated nof methods flushed
    1.18 -Tickspan NMethodSweeper::_total_time_sweeping;                 // Accumulated time sweeping
    1.19 -Tickspan NMethodSweeper::_total_time_this_sweep;               // Total time this sweep
    1.20 -Tickspan NMethodSweeper::_peak_sweep_time;                     // Peak time for a full sweep
    1.21 -Tickspan NMethodSweeper::_peak_sweep_fraction_time;            // Peak time sweeping one fraction
    1.22 -int   NMethodSweeper::_hotness_counter_reset_val       = 0;
    1.23 +long   NMethodSweeper::_total_nof_methods_reclaimed     = 0;    // Accumulated nof methods flushed
    1.24 +long   NMethodSweeper::_total_nof_c2_methods_reclaimed  = 0;    // Accumulated nof methods flushed
    1.25 +size_t NMethodSweeper::_total_flushed_size              = 0;    // Total number of bytes flushed from the code cache
    1.26 +Tickspan  NMethodSweeper::_total_time_sweeping;                 // Accumulated time sweeping
    1.27 +Tickspan  NMethodSweeper::_total_time_this_sweep;               // Total time this sweep
    1.28 +Tickspan  NMethodSweeper::_peak_sweep_time;                     // Peak time for a full sweep
    1.29 +Tickspan  NMethodSweeper::_peak_sweep_fraction_time;            // Peak time sweeping one fraction
    1.30 +
    1.31  
    1.32  
    1.33  class MarkActivationClosure: public CodeBlobClosure {
    1.34 @@ -292,6 +296,7 @@
    1.35  
    1.36      // We are done with sweeping the code cache once.
    1.37      if (_sweep_fractions_left == 0) {
    1.38 +      _total_nof_code_cache_sweeps++;
    1.39        _last_sweep = _time_counter;
    1.40        // Reset flag; temporarily disables sweeper
    1.41        _should_sweep = false;
    1.42 @@ -378,6 +383,7 @@
    1.43    _total_time_sweeping  += sweep_time;
    1.44    _total_time_this_sweep += sweep_time;
    1.45    _peak_sweep_fraction_time = MAX2(sweep_time, _peak_sweep_fraction_time);
    1.46 +  _total_flushed_size += freed_memory;
    1.47    _total_nof_methods_reclaimed += _flushed_count;
    1.48  
    1.49    EventSweepCodeCache event(UNTIMED);
    1.50 @@ -509,6 +515,9 @@
    1.51          tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (marked for reclamation) being flushed", nm->compile_id(), nm);
    1.52        }
    1.53        freed_memory = nm->total_size();
    1.54 +      if (nm->is_compiled_by_c2()) {
    1.55 +        _total_nof_c2_methods_reclaimed++;
    1.56 +      }
    1.57        release_nmethod(nm);
    1.58        _flushed_count++;
    1.59      } else {
    1.60 @@ -547,6 +556,9 @@
    1.61        SWEEP(nm);
    1.62        // No inline caches will ever point to osr methods, so we can just remove it
    1.63        freed_memory = nm->total_size();
    1.64 +      if (nm->is_compiled_by_c2()) {
    1.65 +        _total_nof_c2_methods_reclaimed++;
    1.66 +      }
    1.67        release_nmethod(nm);
    1.68        _flushed_count++;
    1.69      } else {
    1.70 @@ -634,3 +646,13 @@
    1.71      xtty->end_elem();
    1.72    }
    1.73  }
    1.74 +
    1.75 +void NMethodSweeper::print() {
    1.76 +  ttyLocker ttyl;
    1.77 +  tty->print_cr("Code cache sweeper statistics:");
    1.78 +  tty->print_cr("  Total sweep time:                %1.0lfms", (double)_total_time_sweeping.value()/1000000);
    1.79 +  tty->print_cr("  Total number of full sweeps:     %ld", _total_nof_code_cache_sweeps);
    1.80 +  tty->print_cr("  Total number of flushed methods: %ld(%ld C2 methods)", _total_nof_methods_reclaimed,
    1.81 +                                                    _total_nof_c2_methods_reclaimed);
    1.82 +  tty->print_cr("  Total size of flushed methods:   " SIZE_FORMAT "kB", _total_flushed_size/K);
    1.83 +}

mercurial