24
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_HPP
27
28 #include "gc_implementation/g1/collectionSetChooser.hpp"
29 #include "gc_implementation/g1/g1MMUTracker.hpp"
30 #include "memory/collectorPolicy.hpp"
31
32 // A G1CollectorPolicy makes policy decisions that determine the
33 // characteristics of the collector. Examples include:
34 // * choice of collection set.
35 // * when to collect.
36
37 class HeapRegion;
38 class CollectionSetChooser;
39 class G1GCPhaseTimes;
40
41 // TraceGen0Time collects data on _both_ young and mixed evacuation pauses
42 // (the latter may contain non-young regions - i.e. regions that are
43 // technically in Gen1) while TraceGen1Time collects data about full GCs.
44 class TraceGen0TimeData : public CHeapObj<mtGC> {
45 private:
46 unsigned _young_pause_num;
47 unsigned _mixed_pause_num;
48
49 NumberSeq _all_stop_world_times_ms;
50 NumberSeq _all_yield_times_ms;
51
52 NumberSeq _total;
53 NumberSeq _other;
54 NumberSeq _root_region_scan_wait;
55 NumberSeq _parallel;
56 NumberSeq _ext_root_scan;
57 NumberSeq _satb_filtering;
58 NumberSeq _update_rs;
59 NumberSeq _scan_rs;
60 NumberSeq _obj_copy;
61 NumberSeq _termination;
62 NumberSeq _parallel_other;
63 NumberSeq _clear_ct;
64
65 void print_summary(const char* str, const NumberSeq* seq) const;
66 void print_summary_sd(const char* str, const NumberSeq* seq) const;
67
68 public:
69 TraceGen0TimeData() : _young_pause_num(0), _mixed_pause_num(0) {};
70 void record_start_collection(double time_to_stop_the_world_ms);
71 void record_yield_time(double yield_time_ms);
72 void record_end_collection(double pause_time_ms, G1GCPhaseTimes* phase_times);
73 void increment_young_collection_count();
74 void increment_mixed_collection_count();
75 void print() const;
76 };
77
78 class TraceGen1TimeData : public CHeapObj<mtGC> {
79 private:
80 NumberSeq _all_full_gc_times;
81
82 public:
83 void record_full_collection(double full_gc_time_ms);
84 void print() const;
85 };
86
87 // There are three command line options related to the young gen size:
88 // NewSize, MaxNewSize and NewRatio (There is also -Xmn, but that is
89 // just a short form for NewSize==MaxNewSize). G1 will use its internal
90 // heuristics to calculate the actual young gen size, so these options
91 // basically only limit the range within which G1 can pick a young gen
92 // size. Also, these are general options taking byte sizes. G1 will
93 // internally work with a number of regions instead. So, some rounding
94 // will occur.
95 //
96 // If nothing related to the the young gen size is set on the command
97 // line we should allow the young gen to be between G1NewSizePercent
98 // and G1MaxNewSizePercent of the heap size. This means that every time
170 enum SomePrivateConstants {
171 NumPrevPausesForHeuristics = 10
172 };
173
174 G1MMUTracker* _mmu_tracker;
175
176 void initialize_alignments();
177 void initialize_flags();
178
179 CollectionSetChooser* _collectionSetChooser;
180
181 double _full_collection_start_sec;
182 uint _cur_collection_pause_used_regions_at_start;
183
184 // These exclude marking times.
185 TruncatedSeq* _recent_gc_times_ms;
186
187 TruncatedSeq* _concurrent_mark_remark_times_ms;
188 TruncatedSeq* _concurrent_mark_cleanup_times_ms;
189
190 TraceGen0TimeData _trace_gen0_time_data;
191 TraceGen1TimeData _trace_gen1_time_data;
192
193 double _stop_world_start;
194
195 // indicates whether we are in young or mixed GC mode
196 bool _gcs_are_young;
197
198 uint _young_list_target_length;
199 uint _young_list_fixed_length;
200
201 // The max number of regions we can extend the eden by while the GC
202 // locker is active. This should be >= _young_list_target_length;
203 uint _young_list_max_length;
204
205 bool _last_gc_was_young;
206
207 bool _during_marking;
208 bool _in_marking_window;
209 bool _in_marking_window_im;
210
211 SurvRateGroup* _short_lived_surv_rate_group;
|
24
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_HPP
27
28 #include "gc_implementation/g1/collectionSetChooser.hpp"
29 #include "gc_implementation/g1/g1MMUTracker.hpp"
30 #include "memory/collectorPolicy.hpp"
31
32 // A G1CollectorPolicy makes policy decisions that determine the
33 // characteristics of the collector. Examples include:
34 // * choice of collection set.
35 // * when to collect.
36
37 class HeapRegion;
38 class CollectionSetChooser;
39 class G1GCPhaseTimes;
40
41 // TraceGen0Time collects data on _both_ young and mixed evacuation pauses
42 // (the latter may contain non-young regions - i.e. regions that are
43 // technically in Gen1) while TraceGen1Time collects data about full GCs.
44 class TraceYoungGenTimeData : public CHeapObj<mtGC> {
45 private:
46 unsigned _young_pause_num;
47 unsigned _mixed_pause_num;
48
49 NumberSeq _all_stop_world_times_ms;
50 NumberSeq _all_yield_times_ms;
51
52 NumberSeq _total;
53 NumberSeq _other;
54 NumberSeq _root_region_scan_wait;
55 NumberSeq _parallel;
56 NumberSeq _ext_root_scan;
57 NumberSeq _satb_filtering;
58 NumberSeq _update_rs;
59 NumberSeq _scan_rs;
60 NumberSeq _obj_copy;
61 NumberSeq _termination;
62 NumberSeq _parallel_other;
63 NumberSeq _clear_ct;
64
65 void print_summary(const char* str, const NumberSeq* seq) const;
66 void print_summary_sd(const char* str, const NumberSeq* seq) const;
67
68 public:
69 TraceYoungGenTimeData() : _young_pause_num(0), _mixed_pause_num(0) {};
70 void record_start_collection(double time_to_stop_the_world_ms);
71 void record_yield_time(double yield_time_ms);
72 void record_end_collection(double pause_time_ms, G1GCPhaseTimes* phase_times);
73 void increment_young_collection_count();
74 void increment_mixed_collection_count();
75 void print() const;
76 };
77
78 class TraceOldGenTimeData : public CHeapObj<mtGC> {
79 private:
80 NumberSeq _all_full_gc_times;
81
82 public:
83 void record_full_collection(double full_gc_time_ms);
84 void print() const;
85 };
86
87 // There are three command line options related to the young gen size:
88 // NewSize, MaxNewSize and NewRatio (There is also -Xmn, but that is
89 // just a short form for NewSize==MaxNewSize). G1 will use its internal
90 // heuristics to calculate the actual young gen size, so these options
91 // basically only limit the range within which G1 can pick a young gen
92 // size. Also, these are general options taking byte sizes. G1 will
93 // internally work with a number of regions instead. So, some rounding
94 // will occur.
95 //
96 // If nothing related to the the young gen size is set on the command
97 // line we should allow the young gen to be between G1NewSizePercent
98 // and G1MaxNewSizePercent of the heap size. This means that every time
170 enum SomePrivateConstants {
171 NumPrevPausesForHeuristics = 10
172 };
173
174 G1MMUTracker* _mmu_tracker;
175
176 void initialize_alignments();
177 void initialize_flags();
178
179 CollectionSetChooser* _collectionSetChooser;
180
181 double _full_collection_start_sec;
182 uint _cur_collection_pause_used_regions_at_start;
183
184 // These exclude marking times.
185 TruncatedSeq* _recent_gc_times_ms;
186
187 TruncatedSeq* _concurrent_mark_remark_times_ms;
188 TruncatedSeq* _concurrent_mark_cleanup_times_ms;
189
190 TraceYoungGenTimeData _trace_young_gen_time_data;
191 TraceOldGenTimeData _trace_old_gen_time_data;
192
193 double _stop_world_start;
194
195 // indicates whether we are in young or mixed GC mode
196 bool _gcs_are_young;
197
198 uint _young_list_target_length;
199 uint _young_list_fixed_length;
200
201 // The max number of regions we can extend the eden by while the GC
202 // locker is active. This should be >= _young_list_target_length;
203 uint _young_list_max_length;
204
205 bool _last_gc_was_young;
206
207 bool _during_marking;
208 bool _in_marking_window;
209 bool _in_marking_window_im;
210
211 SurvRateGroup* _short_lived_surv_rate_group;
|