27
28 #include "gc/g1/g1CollectorPolicy.hpp"
29 #include "gc/g1/g1CollectorState.hpp"
30 #include "gc/g1/g1GCPhaseTimes.hpp"
31 #include "gc/g1/g1InCSetState.hpp"
32 #include "gc/g1/g1InitialMarkToMixedTimeTracker.hpp"
33 #include "gc/g1/g1MMUTracker.hpp"
34 #include "gc/g1/g1RemSetTrackingPolicy.hpp"
35 #include "gc/g1/g1Predictions.hpp"
36 #include "gc/g1/g1YoungGenSizer.hpp"
37 #include "gc/shared/gcCause.hpp"
38 #include "utilities/pair.hpp"
39
40 // A G1Policy makes policy decisions that determine the
41 // characteristics of the collector. Examples include:
42 // * choice of collection set.
43 // * when to collect.
44
45 class HeapRegion;
46 class G1CollectionSet;
47 class CollectionSetChooser;
48 class G1IHOPControl;
49 class G1Analytics;
50 class G1SurvivorRegions;
51 class G1YoungGenSizer;
52 class GCPolicyCounters;
53 class STWGCTimer;
54
55 class G1Policy: public CHeapObj<mtGC> {
56 private:
57
58 static G1IHOPControl* create_ihop_control(const G1Predictions* predictor);
59 // Update the IHOP control with necessary statistics.
60 void update_ihop_prediction(double mutator_time_s,
61 size_t mutator_alloc_bytes,
62 size_t young_gen_size,
63 bool this_gc_was_young_only);
64 void report_ihop_statistics();
65
66 G1Predictions _predictor;
67 G1Analytics* _analytics;
159
160 double max_pause_time_ms() const {
161 return _mmu_tracker->max_gc_time() * 1000.0;
162 }
163
164 double predict_yg_surv_rate(int age, SurvRateGroup* surv_rate_group) const;
165
166 double predict_yg_surv_rate(int age) const;
167
168 double accum_yg_surv_rate_pred(int age) const;
169
170 private:
171 G1CollectionSet* _collection_set;
172 double average_time_ms(G1GCPhaseTimes::GCParPhases phase) const;
173 double other_time_ms(double pause_time_ms) const;
174
175 double young_other_time_ms() const;
176 double non_young_other_time_ms() const;
177 double constant_other_time_ms(double pause_time_ms) const;
178
179 CollectionSetChooser* cset_chooser() const;
180
181 // The number of bytes copied during the GC.
182 size_t _bytes_copied_during_gc;
183
184 // Stash a pointer to the g1 heap.
185 G1CollectedHeap* _g1h;
186
187 G1GCPhaseTimes* _phase_times;
188
189 // This set of variables tracks the collector efficiency, in order to
190 // determine whether we should initiate a new marking.
191 double _mark_remark_start_sec;
192 double _mark_cleanup_start_sec;
193
194 // Updates the internal young list maximum and target lengths. Returns the
195 // unbounded young list target length.
196 uint update_young_list_max_and_target_length();
197 uint update_young_list_max_and_target_length(size_t rs_lengths);
198
199 // Update the young list target length either by setting it to the
|
27
28 #include "gc/g1/g1CollectorPolicy.hpp"
29 #include "gc/g1/g1CollectorState.hpp"
30 #include "gc/g1/g1GCPhaseTimes.hpp"
31 #include "gc/g1/g1InCSetState.hpp"
32 #include "gc/g1/g1InitialMarkToMixedTimeTracker.hpp"
33 #include "gc/g1/g1MMUTracker.hpp"
34 #include "gc/g1/g1RemSetTrackingPolicy.hpp"
35 #include "gc/g1/g1Predictions.hpp"
36 #include "gc/g1/g1YoungGenSizer.hpp"
37 #include "gc/shared/gcCause.hpp"
38 #include "utilities/pair.hpp"
39
40 // A G1Policy makes policy decisions that determine the
41 // characteristics of the collector. Examples include:
42 // * choice of collection set.
43 // * when to collect.
44
45 class HeapRegion;
46 class G1CollectionSet;
47 class G1CollectionSetChooser;
48 class G1IHOPControl;
49 class G1Analytics;
50 class G1SurvivorRegions;
51 class G1YoungGenSizer;
52 class GCPolicyCounters;
53 class STWGCTimer;
54
55 class G1Policy: public CHeapObj<mtGC> {
56 private:
57
58 static G1IHOPControl* create_ihop_control(const G1Predictions* predictor);
59 // Update the IHOP control with necessary statistics.
60 void update_ihop_prediction(double mutator_time_s,
61 size_t mutator_alloc_bytes,
62 size_t young_gen_size,
63 bool this_gc_was_young_only);
64 void report_ihop_statistics();
65
66 G1Predictions _predictor;
67 G1Analytics* _analytics;
159
160 double max_pause_time_ms() const {
161 return _mmu_tracker->max_gc_time() * 1000.0;
162 }
163
164 double predict_yg_surv_rate(int age, SurvRateGroup* surv_rate_group) const;
165
166 double predict_yg_surv_rate(int age) const;
167
168 double accum_yg_surv_rate_pred(int age) const;
169
170 private:
171 G1CollectionSet* _collection_set;
172 double average_time_ms(G1GCPhaseTimes::GCParPhases phase) const;
173 double other_time_ms(double pause_time_ms) const;
174
175 double young_other_time_ms() const;
176 double non_young_other_time_ms() const;
177 double constant_other_time_ms(double pause_time_ms) const;
178
179 G1CollectionSetChooser* cset_chooser() const;
180
181 // The number of bytes copied during the GC.
182 size_t _bytes_copied_during_gc;
183
184 // Stash a pointer to the g1 heap.
185 G1CollectedHeap* _g1h;
186
187 G1GCPhaseTimes* _phase_times;
188
189 // This set of variables tracks the collector efficiency, in order to
190 // determine whether we should initiate a new marking.
191 double _mark_remark_start_sec;
192 double _mark_cleanup_start_sec;
193
194 // Updates the internal young list maximum and target lengths. Returns the
195 // unbounded young list target length.
196 uint update_young_list_max_and_target_length();
197 uint update_young_list_max_and_target_length(size_t rs_lengths);
198
199 // Update the young list target length either by setting it to the
|