69 0.00006, 0.00003, 0.00003, 0.000015, 0.000015, 0.00001, 0.00001, 0.000009
70 };
71
72 // these should be pretty consistent
73 static double constant_other_time_ms_defaults[] = {
74 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0
75 };
76
77
78 static double young_other_cost_per_region_ms_defaults[] = {
79 0.3, 0.2, 0.2, 0.15, 0.15, 0.12, 0.12, 0.1
80 };
81
82 static double non_young_other_cost_per_region_ms_defaults[] = {
83 1.0, 0.7, 0.7, 0.5, 0.5, 0.42, 0.42, 0.30
84 };
85
86 G1CollectorPolicy::G1CollectorPolicy() :
87 _parallel_gc_threads(ParallelGCThreads),
88
89 _recent_gc_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
90 _stop_world_start(0.0),
91
92 _concurrent_mark_remark_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
93 _concurrent_mark_cleanup_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
94
95 _alloc_rate_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
96 _prev_collection_pause_end_ms(0.0),
97 _rs_length_diff_seq(new TruncatedSeq(TruncatedSeqLength)),
98 _cost_per_card_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
99 _young_cards_per_entry_ratio_seq(new TruncatedSeq(TruncatedSeqLength)),
100 _mixed_cards_per_entry_ratio_seq(new TruncatedSeq(TruncatedSeqLength)),
101 _cost_per_entry_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
102 _mixed_cost_per_entry_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
103 _cost_per_byte_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
104 _cost_per_byte_ms_during_cm_seq(new TruncatedSeq(TruncatedSeqLength)),
105 _constant_other_time_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
106 _young_other_cost_per_region_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
107 _non_young_other_cost_per_region_ms_seq(
108 new TruncatedSeq(TruncatedSeqLength)),
191 // Given that we don't currently have a verboseness level
192 // parameter, we'll hardcode this to high. This can be easily
193 // changed in the future.
194 G1ErgoVerbose::set_level(ErgoHigh);
195 } else {
196 G1ErgoVerbose::set_enabled(false);
197 }
198
199 // Verify PLAB sizes
200 const size_t region_size = HeapRegion::GrainWords;
201 if (YoungPLABSize > region_size || OldPLABSize > region_size) {
202 char buffer[128];
203 jio_snprintf(buffer, sizeof(buffer), "%sPLABSize should be at most "SIZE_FORMAT,
204 OldPLABSize > region_size ? "Old" : "Young", region_size);
205 vm_exit_during_initialization(buffer);
206 }
207
208 _recent_prev_end_times_for_all_gcs_sec->add(os::elapsedTime());
209 _prev_collection_pause_end_ms = os::elapsedTime() * 1000.0;
210
211 _phase_times = new G1GCPhaseTimes(_parallel_gc_threads);
212
213 int index = MIN2(_parallel_gc_threads - 1, 7);
214
215 _rs_length_diff_seq->add(rs_length_diff_defaults[index]);
216 _cost_per_card_ms_seq->add(cost_per_card_ms_defaults[index]);
217 _young_cards_per_entry_ratio_seq->add(
218 young_cards_per_entry_ratio_defaults[index]);
219 _cost_per_entry_ms_seq->add(cost_per_entry_ms_defaults[index]);
220 _cost_per_byte_ms_seq->add(cost_per_byte_ms_defaults[index]);
221 _constant_other_time_ms_seq->add(constant_other_time_ms_defaults[index]);
222 _young_other_cost_per_region_ms_seq->add(
223 young_other_cost_per_region_ms_defaults[index]);
224 _non_young_other_cost_per_region_ms_seq->add(
225 non_young_other_cost_per_region_ms_defaults[index]);
226
227 // Below, we might need to calculate the pause time target based on
228 // the pause interval. When we do so we are going to give G1 maximum
229 // flexibility and allow it to do pauses when it needs to. So, we'll
230 // arrange that the pause interval to be pause time target + 1 to
231 // ensure that a) the pause time target is maximized with respect to
232 // the pause interval and b) we maintain the invariant that pause
418 }
419
420 assert(*min_young_length <= *max_young_length, "Invalid min/max young gen size values");
421 }
422
423 uint G1YoungGenSizer::max_young_length(uint number_of_heap_regions) {
424 // We need to pass the desired values because recalculation may not update these
425 // values in some cases.
426 uint temp = _min_desired_young_length;
427 uint result = _max_desired_young_length;
428 recalculate_min_max_young_length(number_of_heap_regions, &temp, &result);
429 return result;
430 }
431
432 void G1YoungGenSizer::heap_size_changed(uint new_number_of_heap_regions) {
433 recalculate_min_max_young_length(new_number_of_heap_regions, &_min_desired_young_length,
434 &_max_desired_young_length);
435 }
436
437 void G1CollectorPolicy::init() {
438 // Set aside an initial future to_space.
439 _g1 = G1CollectedHeap::heap();
440
441 assert(Heap_lock->owned_by_self(), "Locking discipline.");
442
443 initialize_gc_policy_counters();
444
445 if (adaptive_young_list_length()) {
446 _young_list_fixed_length = 0;
447 } else {
448 _young_list_fixed_length = _young_gen_sizer->min_desired_young_length();
449 }
450 _free_regions_at_end_of_collection = _g1->num_free_regions();
451 update_young_list_target_length();
452
453 // We may immediately start allocating regions and placing them on the
454 // collection set list. Initialize the per-collection set info
455 start_incremental_cset_building();
456 }
457
|
69 0.00006, 0.00003, 0.00003, 0.000015, 0.000015, 0.00001, 0.00001, 0.000009
70 };
71
72 // these should be pretty consistent
73 static double constant_other_time_ms_defaults[] = {
74 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0
75 };
76
77
78 static double young_other_cost_per_region_ms_defaults[] = {
79 0.3, 0.2, 0.2, 0.15, 0.15, 0.12, 0.12, 0.1
80 };
81
82 static double non_young_other_cost_per_region_ms_defaults[] = {
83 1.0, 0.7, 0.7, 0.5, 0.5, 0.42, 0.42, 0.30
84 };
85
86 G1CollectorPolicy::G1CollectorPolicy() :
87 _parallel_gc_threads(ParallelGCThreads),
88
89 _phase_times(NULL),
90
91 _recent_gc_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
92 _stop_world_start(0.0),
93
94 _concurrent_mark_remark_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
95 _concurrent_mark_cleanup_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
96
97 _alloc_rate_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
98 _prev_collection_pause_end_ms(0.0),
99 _rs_length_diff_seq(new TruncatedSeq(TruncatedSeqLength)),
100 _cost_per_card_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
101 _young_cards_per_entry_ratio_seq(new TruncatedSeq(TruncatedSeqLength)),
102 _mixed_cards_per_entry_ratio_seq(new TruncatedSeq(TruncatedSeqLength)),
103 _cost_per_entry_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
104 _mixed_cost_per_entry_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
105 _cost_per_byte_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
106 _cost_per_byte_ms_during_cm_seq(new TruncatedSeq(TruncatedSeqLength)),
107 _constant_other_time_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
108 _young_other_cost_per_region_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
109 _non_young_other_cost_per_region_ms_seq(
110 new TruncatedSeq(TruncatedSeqLength)),
193 // Given that we don't currently have a verboseness level
194 // parameter, we'll hardcode this to high. This can be easily
195 // changed in the future.
196 G1ErgoVerbose::set_level(ErgoHigh);
197 } else {
198 G1ErgoVerbose::set_enabled(false);
199 }
200
201 // Verify PLAB sizes
202 const size_t region_size = HeapRegion::GrainWords;
203 if (YoungPLABSize > region_size || OldPLABSize > region_size) {
204 char buffer[128];
205 jio_snprintf(buffer, sizeof(buffer), "%sPLABSize should be at most "SIZE_FORMAT,
206 OldPLABSize > region_size ? "Old" : "Young", region_size);
207 vm_exit_during_initialization(buffer);
208 }
209
210 _recent_prev_end_times_for_all_gcs_sec->add(os::elapsedTime());
211 _prev_collection_pause_end_ms = os::elapsedTime() * 1000.0;
212
213 int index = MIN2(_parallel_gc_threads - 1, 7);
214
215 _rs_length_diff_seq->add(rs_length_diff_defaults[index]);
216 _cost_per_card_ms_seq->add(cost_per_card_ms_defaults[index]);
217 _young_cards_per_entry_ratio_seq->add(
218 young_cards_per_entry_ratio_defaults[index]);
219 _cost_per_entry_ms_seq->add(cost_per_entry_ms_defaults[index]);
220 _cost_per_byte_ms_seq->add(cost_per_byte_ms_defaults[index]);
221 _constant_other_time_ms_seq->add(constant_other_time_ms_defaults[index]);
222 _young_other_cost_per_region_ms_seq->add(
223 young_other_cost_per_region_ms_defaults[index]);
224 _non_young_other_cost_per_region_ms_seq->add(
225 non_young_other_cost_per_region_ms_defaults[index]);
226
227 // Below, we might need to calculate the pause time target based on
228 // the pause interval. When we do so we are going to give G1 maximum
229 // flexibility and allow it to do pauses when it needs to. So, we'll
230 // arrange that the pause interval to be pause time target + 1 to
231 // ensure that a) the pause time target is maximized with respect to
232 // the pause interval and b) we maintain the invariant that pause
418 }
419
420 assert(*min_young_length <= *max_young_length, "Invalid min/max young gen size values");
421 }
422
423 uint G1YoungGenSizer::max_young_length(uint number_of_heap_regions) {
424 // We need to pass the desired values because recalculation may not update these
425 // values in some cases.
426 uint temp = _min_desired_young_length;
427 uint result = _max_desired_young_length;
428 recalculate_min_max_young_length(number_of_heap_regions, &temp, &result);
429 return result;
430 }
431
432 void G1YoungGenSizer::heap_size_changed(uint new_number_of_heap_regions) {
433 recalculate_min_max_young_length(new_number_of_heap_regions, &_min_desired_young_length,
434 &_max_desired_young_length);
435 }
436
437 void G1CollectorPolicy::init() {
438 _phase_times = new G1GCPhaseTimes(_parallel_gc_threads, G1Log::finest() ? G1CollectedHeap::num_ext_root_tasks() : 0);
439 // Set aside an initial future to_space.
440 _g1 = G1CollectedHeap::heap();
441
442 assert(Heap_lock->owned_by_self(), "Locking discipline.");
443
444 initialize_gc_policy_counters();
445
446 if (adaptive_young_list_length()) {
447 _young_list_fixed_length = 0;
448 } else {
449 _young_list_fixed_length = _young_gen_sizer->min_desired_young_length();
450 }
451 _free_regions_at_end_of_collection = _g1->num_free_regions();
452 update_young_list_target_length();
453
454 // We may immediately start allocating regions and placing them on the
455 // collection set list. Initialize the per-collection set info
456 start_incremental_cset_building();
457 }
458
|