hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
changeset 5240 3892e01609c6
parent 5036 7b652cd72d65
child 5243 99e5a8f5d81f
equal deleted inserted replaced
5109:7077b95d42f6 5240:3892e01609c6
   196                                               G1YoungSurvRateNumRegionsSummary)),
   196                                               G1YoungSurvRateNumRegionsSummary)),
   197   // add here any more surv rate groups
   197   // add here any more surv rate groups
   198   _recorded_survivor_regions(0),
   198   _recorded_survivor_regions(0),
   199   _recorded_survivor_head(NULL),
   199   _recorded_survivor_head(NULL),
   200   _recorded_survivor_tail(NULL),
   200   _recorded_survivor_tail(NULL),
   201   _survivors_age_table(true)
   201   _survivors_age_table(true),
       
   202 
       
   203   _gc_overhead_perc(0.0)
   202 
   204 
   203 {
   205 {
   204   // Set up the region size and associated fields. Given that the
   206   // Set up the region size and associated fields. Given that the
   205   // policy is created before the heap, we have to set this up here,
   207   // policy is created before the heap, we have to set this up here,
   206   // so it's done as soon as possible.
   208   // so it's done as soon as possible.
   272 
   274 
   273   // if G1FixedSurvivorSpaceSize is 0 which means the size is not
   275   // if G1FixedSurvivorSpaceSize is 0 which means the size is not
   274   // fixed, then _max_survivor_regions will be calculated at
   276   // fixed, then _max_survivor_regions will be calculated at
   275   // calculate_young_list_target_config during initialization
   277   // calculate_young_list_target_config during initialization
   276   _max_survivor_regions = G1FixedSurvivorSpaceSize / HeapRegion::GrainBytes;
   278   _max_survivor_regions = G1FixedSurvivorSpaceSize / HeapRegion::GrainBytes;
       
   279 
       
   280   assert(GCTimeRatio > 0,
       
   281          "we should have set it to a default value set_g1_gc_flags() "
       
   282          "if a user set it to 0");
       
   283   _gc_overhead_perc = 100.0 * (1.0 / (1.0 + GCTimeRatio));
   277 
   284 
   278   initialize_all();
   285   initialize_all();
   279 }
   286 }
   280 
   287 
   281 // Increment "i", mod "len"
   288 // Increment "i", mod "len"
  2286   res = MIN2(res, 1.0);
  2293   res = MIN2(res, 1.0);
  2287   return res;
  2294   return res;
  2288 }
  2295 }
  2289 
  2296 
  2290 size_t G1CollectorPolicy::expansion_amount() {
  2297 size_t G1CollectorPolicy::expansion_amount() {
  2291   if ((int)(recent_avg_pause_time_ratio() * 100.0) > G1GCPercent) {
  2298   if ((recent_avg_pause_time_ratio() * 100.0) > _gc_overhead_perc) {
  2292     // We will double the existing space, or take
  2299     // We will double the existing space, or take
  2293     // G1ExpandByPercentOfAvailable % of the available expansion
  2300     // G1ExpandByPercentOfAvailable % of the available expansion
  2294     // space, whichever is smaller, bounded below by a minimum
  2301     // space, whichever is smaller, bounded below by a minimum
  2295     // expansion (unless that's all that's left.)
  2302     // expansion (unless that's all that's left.)
  2296     const size_t min_expand_bytes = 1*M;
  2303     const size_t min_expand_bytes = 1*M;