465 size_t promo_limit = (size_t)(max_old_gen_size - avg_old_live()->average());
466
467 // But don't force a promo size below the current promo size. Otherwise,
468 // the promo size will shrink for no good reason.
469 promo_limit = MAX2(promo_limit, _promo_size);
470
471 const double gc_cost_limit = GCTimeLimit/100.0;
472
473 // Which way should we go?
474 // if pause requirement is not met
475 // adjust size of any generation with average paus exceeding
476 // the pause limit. Adjust one pause at a time (the larger)
477 // and only make adjustments for the major pause at full collections.
478 // else if throughput requirement not met
479 // adjust the size of the generation with larger gc time. Only
480 // adjust one generation at a time.
481 // else
482 // adjust down the total heap size. Adjust down the larger of the
483 // generations.
484
485 // Add some checks for a threshhold for a change. For example,
486 // a change less than the necessary alignment is probably not worth
487 // attempting.
488
489 if ((_avg_minor_pause->padded_average() > gc_pause_goal_sec()) ||
490 (_avg_major_pause->padded_average() > gc_pause_goal_sec())) {
491 //
492 // Check pauses
493 //
494 // Make changes only to affect one of the pauses (the larger)
495 // at a time.
496 if (is_full_gc) {
497 set_decide_at_full_gc(decide_at_full_gc_true);
498 adjust_promo_for_pause_time(is_full_gc, &desired_promo_size, &desired_eden_size);
499 }
500 } else if (_avg_minor_pause->padded_average() > gc_minor_pause_goal_sec()) {
501 // Adjust only for the minor pause time goal
502 adjust_promo_for_minor_pause_time(is_full_gc, &desired_promo_size, &desired_eden_size);
503 } else if(adjusted_mutator_cost() < _throughput_goal) {
504 // This branch used to require that (mutator_cost() > 0.0 in 1.4.2.
505 // This sometimes resulted in skipping to the minimize footprint
1144 return tenuring_threshold;
1145 }
1146
1147 // We'll decide whether to increase or decrease the tenuring
1148 // threshold based partly on the newly computed survivor size
1149 // (if we hit the maximum limit allowed, we'll always choose to
1150 // decrement the threshold).
1151 bool incr_tenuring_threshold = false;
1152 bool decr_tenuring_threshold = false;
1153
1154 set_decrement_tenuring_threshold_for_gc_cost(false);
1155 set_increment_tenuring_threshold_for_gc_cost(false);
1156 set_decrement_tenuring_threshold_for_survivor_limit(false);
1157
1158 if (!is_survivor_overflow) {
1159 // Keep running averages on how much survived
1160
1161 // We use the tenuring threshold to equalize the cost of major
1162 // and minor collections.
1163 // ThresholdTolerance is used to indicate how sensitive the
1164 // tenuring threshold is to differences in cost betweent the
1165 // collection types.
1166
1167 // Get the times of interest. This involves a little work, so
1168 // we cache the values here.
1169 const double major_cost = major_gc_cost();
1170 const double minor_cost = minor_gc_cost();
1171
1172 if (minor_cost > major_cost * _threshold_tolerance_percent) {
1173 // Minor times are getting too long; lower the threshold so
1174 // less survives and more is promoted.
1175 decr_tenuring_threshold = true;
1176 set_decrement_tenuring_threshold_for_gc_cost(true);
1177 } else if (major_cost > minor_cost * _threshold_tolerance_percent) {
1178 // Major times are too long, so we want less promotion.
1179 incr_tenuring_threshold = true;
1180 set_increment_tenuring_threshold_for_gc_cost(true);
1181 }
1182
1183 } else {
1184 // Survivor space overflow occurred, so promoted and survived are
|
465 size_t promo_limit = (size_t)(max_old_gen_size - avg_old_live()->average());
466
467 // But don't force a promo size below the current promo size. Otherwise,
468 // the promo size will shrink for no good reason.
469 promo_limit = MAX2(promo_limit, _promo_size);
470
471 const double gc_cost_limit = GCTimeLimit/100.0;
472
473 // Which way should we go?
474 // if pause requirement is not met
475 // adjust size of any generation with average paus exceeding
476 // the pause limit. Adjust one pause at a time (the larger)
477 // and only make adjustments for the major pause at full collections.
478 // else if throughput requirement not met
479 // adjust the size of the generation with larger gc time. Only
480 // adjust one generation at a time.
481 // else
482 // adjust down the total heap size. Adjust down the larger of the
483 // generations.
484
485 // Add some checks for a threshold for a change. For example,
486 // a change less than the necessary alignment is probably not worth
487 // attempting.
488
489 if ((_avg_minor_pause->padded_average() > gc_pause_goal_sec()) ||
490 (_avg_major_pause->padded_average() > gc_pause_goal_sec())) {
491 //
492 // Check pauses
493 //
494 // Make changes only to affect one of the pauses (the larger)
495 // at a time.
496 if (is_full_gc) {
497 set_decide_at_full_gc(decide_at_full_gc_true);
498 adjust_promo_for_pause_time(is_full_gc, &desired_promo_size, &desired_eden_size);
499 }
500 } else if (_avg_minor_pause->padded_average() > gc_minor_pause_goal_sec()) {
501 // Adjust only for the minor pause time goal
502 adjust_promo_for_minor_pause_time(is_full_gc, &desired_promo_size, &desired_eden_size);
503 } else if(adjusted_mutator_cost() < _throughput_goal) {
504 // This branch used to require that (mutator_cost() > 0.0 in 1.4.2.
505 // This sometimes resulted in skipping to the minimize footprint
1144 return tenuring_threshold;
1145 }
1146
1147 // We'll decide whether to increase or decrease the tenuring
1148 // threshold based partly on the newly computed survivor size
1149 // (if we hit the maximum limit allowed, we'll always choose to
1150 // decrement the threshold).
1151 bool incr_tenuring_threshold = false;
1152 bool decr_tenuring_threshold = false;
1153
1154 set_decrement_tenuring_threshold_for_gc_cost(false);
1155 set_increment_tenuring_threshold_for_gc_cost(false);
1156 set_decrement_tenuring_threshold_for_survivor_limit(false);
1157
1158 if (!is_survivor_overflow) {
1159 // Keep running averages on how much survived
1160
1161 // We use the tenuring threshold to equalize the cost of major
1162 // and minor collections.
1163 // ThresholdTolerance is used to indicate how sensitive the
1164 // tenuring threshold is to differences in cost between the
1165 // collection types.
1166
1167 // Get the times of interest. This involves a little work, so
1168 // we cache the values here.
1169 const double major_cost = major_gc_cost();
1170 const double minor_cost = minor_gc_cost();
1171
1172 if (minor_cost > major_cost * _threshold_tolerance_percent) {
1173 // Minor times are getting too long; lower the threshold so
1174 // less survives and more is promoted.
1175 decr_tenuring_threshold = true;
1176 set_decrement_tenuring_threshold_for_gc_cost(true);
1177 } else if (major_cost > minor_cost * _threshold_tolerance_percent) {
1178 // Major times are too long, so we want less promotion.
1179 incr_tenuring_threshold = true;
1180 set_increment_tenuring_threshold_for_gc_cost(true);
1181 }
1182
1183 } else {
1184 // Survivor space overflow occurred, so promoted and survived are
|