35
36 #include <math.h>
37
38 PSAdaptiveSizePolicy::PSAdaptiveSizePolicy(size_t init_eden_size,
39 size_t init_promo_size,
40 size_t init_survivor_size,
41 size_t space_alignment,
42 double gc_pause_goal_sec,
43 double gc_minor_pause_goal_sec,
44 uint gc_cost_ratio) :
45 AdaptiveSizePolicy(init_eden_size,
46 init_promo_size,
47 init_survivor_size,
48 gc_pause_goal_sec,
49 gc_cost_ratio),
50 _collection_cost_margin_fraction(AdaptiveSizePolicyCollectionCostMargin / 100.0),
51 _space_alignment(space_alignment),
52 _live_at_last_full_gc(init_promo_size),
53 _gc_minor_pause_goal_sec(gc_minor_pause_goal_sec),
54 _latest_major_mutator_interval_seconds(0),
55 _young_gen_change_for_major_pause_count(0)
56 {
57 // Sizing policy statistics
58 _avg_major_pause =
59 new AdaptivePaddedAverage(AdaptiveTimeWeight, PausePadding);
60 _avg_minor_interval = new AdaptiveWeightedAverage(AdaptiveTimeWeight);
61 _avg_major_interval = new AdaptiveWeightedAverage(AdaptiveTimeWeight);
62
63 _avg_base_footprint = new AdaptiveWeightedAverage(AdaptiveSizePolicyWeight);
64 _major_pause_old_estimator =
65 new LinearLeastSquareFit(AdaptiveSizePolicyWeight);
66 _major_pause_young_estimator =
67 new LinearLeastSquareFit(AdaptiveSizePolicyWeight);
68 _major_collection_estimator =
69 new LinearLeastSquareFit(AdaptiveSizePolicyWeight);
70
71 _young_gen_size_increment_supplement = YoungGenerationSizeSupplement;
72 _old_gen_size_increment_supplement = TenuredGenerationSizeSupplement;
73
74 // Start the timers
75 _major_timer.start();
1287 _avg_pretenured->padded_average(),
1288 tenuring_threshold, target_size);
1289 }
1290
1291 set_survivor_size(target_size);
1292
1293 return tenuring_threshold;
1294 }
1295
1296 void PSAdaptiveSizePolicy::update_averages(bool is_survivor_overflow,
1297 size_t survived,
1298 size_t promoted) {
1299 // Update averages
1300 if (!is_survivor_overflow) {
1301 // Keep running averages on how much survived
1302 _avg_survived->sample(survived);
1303 } else {
1304 size_t survived_guess = survived + promoted;
1305 _avg_survived->sample(survived_guess);
1306 }
1307 avg_promoted()->sample(promoted + _avg_pretenured->padded_average());
1308
1309 if (PrintAdaptiveSizePolicy) {
1310 gclog_or_tty->print_cr(
1311 "AdaptiveSizePolicy::update_averages:"
1312 " survived: " SIZE_FORMAT
1313 " promoted: " SIZE_FORMAT
1314 " overflow: %s",
1315 survived, promoted, is_survivor_overflow ? "true" : "false");
1316 }
1317 }
1318
1319 bool PSAdaptiveSizePolicy::print_adaptive_size_policy_on(outputStream* st)
1320 const {
1321
1322 if (!UseAdaptiveSizePolicy) return false;
1323
1324 return AdaptiveSizePolicy::print_adaptive_size_policy_on(
1325 st,
1326 PSScavenge::tenuring_threshold());
1327 }
|
35
36 #include <math.h>
37
38 PSAdaptiveSizePolicy::PSAdaptiveSizePolicy(size_t init_eden_size,
39 size_t init_promo_size,
40 size_t init_survivor_size,
41 size_t space_alignment,
42 double gc_pause_goal_sec,
43 double gc_minor_pause_goal_sec,
44 uint gc_cost_ratio) :
45 AdaptiveSizePolicy(init_eden_size,
46 init_promo_size,
47 init_survivor_size,
48 gc_pause_goal_sec,
49 gc_cost_ratio),
50 _collection_cost_margin_fraction(AdaptiveSizePolicyCollectionCostMargin / 100.0),
51 _space_alignment(space_alignment),
52 _live_at_last_full_gc(init_promo_size),
53 _gc_minor_pause_goal_sec(gc_minor_pause_goal_sec),
54 _latest_major_mutator_interval_seconds(0),
55 _young_gen_change_for_major_pause_count(0),
56 _total_pretenured_since_last_promotion(0)
57 {
58 // Sizing policy statistics
59 _avg_major_pause =
60 new AdaptivePaddedAverage(AdaptiveTimeWeight, PausePadding);
61 _avg_minor_interval = new AdaptiveWeightedAverage(AdaptiveTimeWeight);
62 _avg_major_interval = new AdaptiveWeightedAverage(AdaptiveTimeWeight);
63
64 _avg_base_footprint = new AdaptiveWeightedAverage(AdaptiveSizePolicyWeight);
65 _major_pause_old_estimator =
66 new LinearLeastSquareFit(AdaptiveSizePolicyWeight);
67 _major_pause_young_estimator =
68 new LinearLeastSquareFit(AdaptiveSizePolicyWeight);
69 _major_collection_estimator =
70 new LinearLeastSquareFit(AdaptiveSizePolicyWeight);
71
72 _young_gen_size_increment_supplement = YoungGenerationSizeSupplement;
73 _old_gen_size_increment_supplement = TenuredGenerationSizeSupplement;
74
75 // Start the timers
76 _major_timer.start();
1288 _avg_pretenured->padded_average(),
1289 tenuring_threshold, target_size);
1290 }
1291
1292 set_survivor_size(target_size);
1293
1294 return tenuring_threshold;
1295 }
1296
1297 void PSAdaptiveSizePolicy::update_averages(bool is_survivor_overflow,
1298 size_t survived,
1299 size_t promoted) {
1300 // Update averages
1301 if (!is_survivor_overflow) {
1302 // Keep running averages on how much survived
1303 _avg_survived->sample(survived);
1304 } else {
1305 size_t survived_guess = survived + promoted;
1306 _avg_survived->sample(survived_guess);
1307 }
1308 avg_promoted()->sample(promoted + total_pretenured_since_last_promotion());
1309 reset_total_pretenured_since_last_promotion();
1310
1311 if (PrintAdaptiveSizePolicy) {
1312 gclog_or_tty->print_cr(
1313 "AdaptiveSizePolicy::update_averages:"
1314 " survived: " SIZE_FORMAT
1315 " promoted: " SIZE_FORMAT
1316 " overflow: %s",
1317 survived, promoted, is_survivor_overflow ? "true" : "false");
1318 }
1319 }
1320
1321 bool PSAdaptiveSizePolicy::print_adaptive_size_policy_on(outputStream* st)
1322 const {
1323
1324 if (!UseAdaptiveSizePolicy) return false;
1325
1326 return AdaptiveSizePolicy::print_adaptive_size_policy_on(
1327 st,
1328 PSScavenge::tenuring_threshold());
1329 }
|