src/hotspot/share/gc/g1/g1Analytics.cpp
changeset 59222 f4f60bb75ee4
parent 58798 08e78887ff96
child 59319 9ee940f1de90
equal deleted inserted replaced
59221:cc3a82fc7bcb 59222:f4f60bb75ee4
    26 #include "gc/g1/g1Analytics.hpp"
    26 #include "gc/g1/g1Analytics.hpp"
    27 #include "gc/g1/g1Predictions.hpp"
    27 #include "gc/g1/g1Predictions.hpp"
    28 #include "runtime/globals.hpp"
    28 #include "runtime/globals.hpp"
    29 #include "runtime/os.hpp"
    29 #include "runtime/os.hpp"
    30 #include "utilities/debug.hpp"
    30 #include "utilities/debug.hpp"
       
    31 #include "utilities/globalDefinitions.hpp"
    31 #include "utilities/numberSeq.hpp"
    32 #include "utilities/numberSeq.hpp"
    32 
    33 
    33 // Different defaults for different number of GC threads
    34 // Different defaults for different number of GC threads
    34 // They were chosen by running GCOld and SPECjbb on debris with different
    35 // They were chosen by running GCOld and SPECjbb on debris with different
    35 //   numbers of GC threads and choosing them based on the results
    36 //   numbers of GC threads and choosing them based on the results
   142   _alloc_rate_ms_seq->add(alloc_rate);
   143   _alloc_rate_ms_seq->add(alloc_rate);
   143 }
   144 }
   144 
   145 
   145 void G1Analytics::compute_pause_time_ratio(double interval_ms, double pause_time_ms) {
   146 void G1Analytics::compute_pause_time_ratio(double interval_ms, double pause_time_ms) {
   146   _recent_avg_pause_time_ratio = _recent_gc_times_ms->sum() / interval_ms;
   147   _recent_avg_pause_time_ratio = _recent_gc_times_ms->sum() / interval_ms;
   147   if (_recent_avg_pause_time_ratio < 0.0 ||
   148 
   148       (_recent_avg_pause_time_ratio - 1.0 > 0.0)) {
   149   // Clamp the result to [0.0 ... 1.0] to filter out nonsensical results due to bad input.
   149     // Clip ratio between 0.0 and 1.0, and continue. This will be fixed in
   150   _recent_avg_pause_time_ratio = clamp(_recent_avg_pause_time_ratio, 0.0, 1.0);
   150     // CR 6902692 by redoing the manner in which the ratio is incrementally computed.
       
   151     if (_recent_avg_pause_time_ratio < 0.0) {
       
   152       _recent_avg_pause_time_ratio = 0.0;
       
   153     } else {
       
   154       assert(_recent_avg_pause_time_ratio - 1.0 > 0.0, "Ctl-point invariant");
       
   155       _recent_avg_pause_time_ratio = 1.0;
       
   156     }
       
   157   }
       
   158 
   151 
   159   // Compute the ratio of just this last pause time to the entire time range stored
   152   // Compute the ratio of just this last pause time to the entire time range stored
   160   // in the vectors. Comparing this pause to the entire range, rather than only the
   153   // in the vectors. Comparing this pause to the entire range, rather than only the
   161   // most recent interval, has the effect of smoothing over a possible transient 'burst'
   154   // most recent interval, has the effect of smoothing over a possible transient 'burst'
   162   // of more frequent pauses that don't really reflect a change in heap occupancy.
   155   // of more frequent pauses that don't really reflect a change in heap occupancy.