35 // * when to collect. |
35 // * when to collect. |
36 |
36 |
37 class HeapRegion; |
37 class HeapRegion; |
38 class CollectionSetChooser; |
38 class CollectionSetChooser; |
39 |
39 |
40 // Yes, this is a bit unpleasant... but it saves replicating the same thing |
40 // TraceGen0Time collects data on _both_ young and mixed evacuation pauses |
41 // over and over again and introducing subtle problems through small typos and |
41 // (the latter may contain non-young regions - i.e. regions that are |
42 // cutting and pasting mistakes. The macros below introduces a number |
42 // technically in Gen1) while TraceGen1Time collects data about full GCs. |
43 // sequnce into the following two classes and the methods that access it. |
43 class TraceGen0TimeData : public CHeapObj { |
44 |
44 private: |
45 #define define_num_seq(name) \ |
45 unsigned _young_pause_num; |
46 private: \ |
46 unsigned _mixed_pause_num; |
47 NumberSeq _all_##name##_times_ms; \ |
47 |
48 public: \ |
48 NumberSeq _all_stop_world_times_ms; |
49 void record_##name##_time_ms(double ms) { \ |
49 NumberSeq _all_yield_times_ms; |
50 _all_##name##_times_ms.add(ms); \ |
50 |
51 } \ |
51 NumberSeq _total; |
52 NumberSeq* get_##name##_seq() { \ |
52 NumberSeq _other; |
53 return &_all_##name##_times_ms; \ |
53 NumberSeq _root_region_scan_wait; |
54 } |
54 NumberSeq _parallel; |
55 |
55 NumberSeq _ext_root_scan; |
56 class MainBodySummary; |
56 NumberSeq _satb_filtering; |
57 |
57 NumberSeq _update_rs; |
58 class PauseSummary: public CHeapObj { |
58 NumberSeq _scan_rs; |
59 define_num_seq(total) |
59 NumberSeq _obj_copy; |
60 define_num_seq(other) |
60 NumberSeq _termination; |
|
61 NumberSeq _parallel_other; |
|
62 NumberSeq _clear_ct; |
|
63 |
|
64 void print_summary (int level, const char* str, const NumberSeq* seq) const; |
|
65 void print_summary_sd (int level, const char* str, const NumberSeq* seq) const; |
61 |
66 |
62 public: |
67 public: |
63 virtual MainBodySummary* main_body_summary() { return NULL; } |
68 TraceGen0TimeData() : _young_pause_num(0), _mixed_pause_num(0) {}; |
|
69 void record_start_collection(double time_to_stop_the_world_ms); |
|
70 void record_yield_time(double yield_time_ms); |
|
71 void record_end_collection( |
|
72 double total_ms, |
|
73 double other_ms, |
|
74 double root_region_scan_wait_ms, |
|
75 double parallel_ms, |
|
76 double ext_root_scan_ms, |
|
77 double satb_filtering_ms, |
|
78 double update_rs_ms, |
|
79 double scan_rs_ms, |
|
80 double obj_copy_ms, |
|
81 double termination_ms, |
|
82 double parallel_other_ms, |
|
83 double clear_ct_ms); |
|
84 void increment_young_collection_count(); |
|
85 void increment_mixed_collection_count(); |
|
86 void print() const; |
64 }; |
87 }; |
65 |
88 |
66 class MainBodySummary: public CHeapObj { |
89 class TraceGen1TimeData : public CHeapObj { |
67 define_num_seq(root_region_scan_wait) |
90 private: |
68 define_num_seq(parallel) // parallel only |
91 NumberSeq _all_full_gc_times; |
69 define_num_seq(ext_root_scan) |
92 |
70 define_num_seq(satb_filtering) |
93 public: |
71 define_num_seq(update_rs) |
94 void record_full_collection(double full_gc_time_ms); |
72 define_num_seq(scan_rs) |
95 void print() const; |
73 define_num_seq(obj_copy) |
|
74 define_num_seq(termination) // parallel only |
|
75 define_num_seq(parallel_other) // parallel only |
|
76 define_num_seq(clear_ct) |
|
77 }; |
|
78 |
|
79 class Summary: public PauseSummary, |
|
80 public MainBodySummary { |
|
81 public: |
|
82 virtual MainBodySummary* main_body_summary() { return this; } |
|
83 }; |
96 }; |
84 |
97 |
85 // There are three command line options related to the young gen size: |
98 // There are three command line options related to the young gen size: |
86 // NewSize, MaxNewSize and NewRatio (There is also -Xmn, but that is |
99 // NewSize, MaxNewSize and NewRatio (There is also -Xmn, but that is |
87 // just a short form for NewSize==MaxNewSize). G1 will use its internal |
100 // just a short form for NewSize==MaxNewSize). G1 will use its internal |
197 TruncatedSeq* _recent_gc_times_ms; |
210 TruncatedSeq* _recent_gc_times_ms; |
198 |
211 |
199 TruncatedSeq* _concurrent_mark_remark_times_ms; |
212 TruncatedSeq* _concurrent_mark_remark_times_ms; |
200 TruncatedSeq* _concurrent_mark_cleanup_times_ms; |
213 TruncatedSeq* _concurrent_mark_cleanup_times_ms; |
201 |
214 |
202 Summary* _summary; |
215 TraceGen0TimeData _trace_gen0_time_data; |
203 |
216 TraceGen1TimeData _trace_gen1_time_data; |
204 NumberSeq* _all_pause_times_ms; |
217 |
205 NumberSeq* _all_full_gc_times_ms; |
|
206 double _stop_world_start; |
218 double _stop_world_start; |
207 NumberSeq* _all_stop_world_times_ms; |
|
208 NumberSeq* _all_yield_times_ms; |
|
209 |
|
210 int _aux_num; |
|
211 NumberSeq* _all_aux_times_ms; |
|
212 double* _cur_aux_start_times_ms; |
|
213 double* _cur_aux_times_ms; |
|
214 bool* _cur_aux_times_set; |
|
215 |
219 |
216 double* _par_last_gc_worker_start_times_ms; |
220 double* _par_last_gc_worker_start_times_ms; |
217 double* _par_last_ext_root_scan_times_ms; |
221 double* _par_last_ext_root_scan_times_ms; |
218 double* _par_last_satb_filtering_times_ms; |
222 double* _par_last_satb_filtering_times_ms; |
219 double* _par_last_update_rs_times_ms; |
223 double* _par_last_update_rs_times_ms; |
241 // locker is active. This should be >= _young_list_target_length; |
245 // locker is active. This should be >= _young_list_target_length; |
242 uint _young_list_max_length; |
246 uint _young_list_max_length; |
243 |
247 |
244 bool _last_gc_was_young; |
248 bool _last_gc_was_young; |
245 |
249 |
246 unsigned _young_pause_num; |
|
247 unsigned _mixed_pause_num; |
|
248 |
|
249 bool _during_marking; |
250 bool _during_marking; |
250 bool _in_marking_window; |
251 bool _in_marking_window; |
251 bool _in_marking_window_im; |
252 bool _in_marking_window_im; |
252 |
253 |
253 SurvRateGroup* _short_lived_surv_rate_group; |
254 SurvRateGroup* _short_lived_surv_rate_group; |
554 void print_stats(int level, const char* str, double value); |
555 void print_stats(int level, const char* str, double value); |
555 void print_stats(int level, const char* str, double value, int workers); |
556 void print_stats(int level, const char* str, double value, int workers); |
556 void print_stats(int level, const char* str, int value); |
557 void print_stats(int level, const char* str, int value); |
557 |
558 |
558 void print_par_stats(int level, const char* str, double* data, bool showDecimals = true); |
559 void print_par_stats(int level, const char* str, double* data, bool showDecimals = true); |
559 |
|
560 void check_other_times(int level, |
|
561 NumberSeq* other_times_ms, |
|
562 NumberSeq* calc_other_times_ms) const; |
|
563 |
|
564 void print_summary (PauseSummary* stats) const; |
|
565 |
|
566 void print_summary (int level, const char* str, NumberSeq* seq) const; |
|
567 void print_summary_sd (int level, const char* str, NumberSeq* seq) const; |
|
568 |
560 |
569 double avg_value (double* data); |
561 double avg_value (double* data); |
570 double max_value (double* data); |
562 double max_value (double* data); |
571 double sum_of_values (double* data); |
563 double sum_of_values (double* data); |
572 double max_sum (double* data1, double* data2); |
564 double max_sum (double* data1, double* data2); |
863 _cur_collection_par_time_ms = ms; |
851 _cur_collection_par_time_ms = ms; |
864 } |
852 } |
865 |
853 |
866 void record_code_root_fixup_time(double ms) { |
854 void record_code_root_fixup_time(double ms) { |
867 _cur_collection_code_root_fixup_time_ms = ms; |
855 _cur_collection_code_root_fixup_time_ms = ms; |
868 } |
|
869 |
|
870 void record_aux_start_time(int i) { |
|
871 guarantee(i < _aux_num, "should be within range"); |
|
872 _cur_aux_start_times_ms[i] = os::elapsedTime() * 1000.0; |
|
873 } |
|
874 |
|
875 void record_aux_end_time(int i) { |
|
876 guarantee(i < _aux_num, "should be within range"); |
|
877 double ms = os::elapsedTime() * 1000.0 - _cur_aux_start_times_ms[i]; |
|
878 _cur_aux_times_set[i] = true; |
|
879 _cur_aux_times_ms[i] += ms; |
|
880 } |
856 } |
881 |
857 |
882 void record_ref_proc_time(double ms) { |
858 void record_ref_proc_time(double ms) { |
883 _cur_ref_proc_time_ms = ms; |
859 _cur_ref_proc_time_ms = ms; |
884 } |
860 } |