46 public:
47 enum GCParPhases {
48 GCWorkerStart,
49 ExtRootScan,
50 ThreadRoots,
51 StringTableRoots,
52 UniverseRoots,
53 JNIRoots,
54 ObjectSynchronizerRoots,
55 ManagementRoots,
56 SystemDictionaryRoots,
57 CLDGRoots,
58 JVMTIRoots,
59 CMRefRoots,
60 WaitForStrongCLD,
61 WeakCLDRoots,
62 SATBFiltering,
63 UpdateRS,
64 ScanHCC,
65 ScanRS,
66 CodeRoots,
67 #if INCLUDE_AOT
68 AOTCodeRoots,
69 #endif
70 ObjCopy,
71 Termination,
72 Other,
73 GCWorkerTotal,
74 GCWorkerEnd,
75 StringDedupQueueFixup,
76 StringDedupTableFixup,
77 RedirtyCards,
78 YoungFreeCSet,
79 NonYoungFreeCSet,
80 GCParPhasesSentinel
81 };
82
83 enum GCScanRSWorkItems {
84 ScanRSScannedCards,
85 ScanRSClaimedCards,
86 ScanRSSkippedCards
87 };
88
89 enum GCUpdateRSWorkItems {
90 UpdateRSProcessedBuffers,
91 UpdateRSScannedCards,
92 UpdateRSSkippedCards
93 };
94
95 private:
96 // Markers for grouping the phases in the GCPhases enum above
97 static const int GCMainParPhasesLast = GCWorkerEnd;
98 static const int StringDedupPhasesFirst = StringDedupQueueFixup;
99 static const int StringDedupPhasesLast = StringDedupTableFixup;
100
101 WorkerDataArray<double>* _gc_par_phases[GCParPhasesSentinel];
102
103 WorkerDataArray<size_t>* _update_rs_processed_buffers;
104 WorkerDataArray<size_t>* _update_rs_scanned_cards;
105 WorkerDataArray<size_t>* _update_rs_skipped_cards;
106
107 WorkerDataArray<size_t>* _scan_rs_scanned_cards;
108 WorkerDataArray<size_t>* _scan_rs_claimed_cards;
109 WorkerDataArray<size_t>* _scan_rs_skipped_cards;
110
111 WorkerDataArray<size_t>* _termination_attempts;
112
113 WorkerDataArray<size_t>* _redirtied_cards;
114
115 double _cur_collection_par_time_ms;
116 double _cur_collection_code_root_fixup_time_ms;
117 double _cur_strong_code_root_purge_time_ms;
118
119 double _cur_evac_fail_recalc_used;
120 double _cur_evac_fail_remove_self_forwards;
121
122 double _cur_string_dedup_fixup_time_ms;
123
124 double _cur_prepare_tlab_time_ms;
125 double _cur_resize_tlab_time_ms;
126
127 double _cur_derived_pointer_table_update_time_ms;
128
129 double _cur_clear_ct_time_ms;
130 double _cur_expand_heap_time_ms;
131 double _cur_ref_proc_time_ms;
132
133 double _cur_collection_start_sec;
134 double _root_region_scan_wait_time_ms;
135
167 double worker_time(GCParPhases phase, uint worker);
168 void note_gc_end();
169 void reset();
170
171 template <class T>
172 void details(T* phase, const char* indent) const;
173
174 void log_phase(WorkerDataArray<double>* phase, uint indent, outputStream* out, bool print_sum) const;
175 void debug_phase(WorkerDataArray<double>* phase) const;
176 void trace_phase(WorkerDataArray<double>* phase, bool print_sum = true) const;
177
178 void info_time(const char* name, double value) const;
179 void debug_time(const char* name, double value) const;
180 // This will print logs for both 'gc+phases' and 'gc+phases+ref'.
181 void debug_time_for_reference(const char* name, double value) const;
182 void trace_time(const char* name, double value) const;
183 void trace_count(const char* name, size_t value) const;
184
185 double print_pre_evacuate_collection_set() const;
186 double print_evacuate_collection_set() const;
187 double print_post_evacuate_collection_set() const;
188 void print_other(double accounted_ms) const;
189
190 public:
191 G1GCPhaseTimes(STWGCTimer* gc_timer, uint max_gc_threads);
192 void note_gc_start();
193 void print();
194 static const char* phase_name(GCParPhases phase);
195
196 // record the time a phase took in seconds
197 void record_time_secs(GCParPhases phase, uint worker_i, double secs);
198
199 // add a number of seconds to a phase
200 void add_time_secs(GCParPhases phase, uint worker_i, double secs);
201
202 void record_or_add_objcopy_time_secs(uint worker_i, double secs);
203
204 void record_thread_work_item(GCParPhases phase, uint worker_i, size_t count, uint index = 0);
205
206 // return the average time for a phase in milliseconds
207 double average_time_ms(GCParPhases phase);
208
209 size_t sum_thread_work_items(GCParPhases phase, uint index = 0);
210
211 public:
212
213 void record_prepare_tlab_time_ms(double ms) {
214 _cur_prepare_tlab_time_ms = ms;
215 }
216
217 void record_resize_tlab_time_ms(double ms) {
218 _cur_resize_tlab_time_ms = ms;
219 }
220
221 void record_derived_pointer_table_update_time(double ms) {
222 _cur_derived_pointer_table_update_time_ms = ms;
223 }
224
225 void record_clear_ct_time(double ms) {
226 _cur_clear_ct_time_ms = ms;
227 }
228
229 void record_expand_heap_time(double ms) {
230 _cur_expand_heap_time_ms = ms;
231 }
232
233 void record_par_time(double ms) {
234 _cur_collection_par_time_ms = ms;
235 }
236
237 void record_code_root_fixup_time(double ms) {
238 _cur_collection_code_root_fixup_time_ms = ms;
239 }
240
241 void record_strong_code_root_purge_time(double ms) {
242 _cur_strong_code_root_purge_time_ms = ms;
243 }
244
245 void record_evac_fail_recalc_used_time(double ms) {
246 _cur_evac_fail_recalc_used = ms;
247 }
248
249 void record_evac_fail_remove_self_forwards(double ms) {
250 _cur_evac_fail_remove_self_forwards = ms;
251 }
252
253 void record_string_dedup_fixup_time(double ms) {
254 _cur_string_dedup_fixup_time_ms = ms;
|
46 public:
47 enum GCParPhases {
48 GCWorkerStart,
49 ExtRootScan,
50 ThreadRoots,
51 StringTableRoots,
52 UniverseRoots,
53 JNIRoots,
54 ObjectSynchronizerRoots,
55 ManagementRoots,
56 SystemDictionaryRoots,
57 CLDGRoots,
58 JVMTIRoots,
59 CMRefRoots,
60 WaitForStrongCLD,
61 WeakCLDRoots,
62 SATBFiltering,
63 UpdateRS,
64 ScanHCC,
65 ScanRS,
66 OptScanRS,
67 CodeRoots,
68 #if INCLUDE_AOT
69 AOTCodeRoots,
70 #endif
71 ObjCopy,
72 OptObjCopy,
73 Termination,
74 Other,
75 GCWorkerTotal,
76 GCWorkerEnd,
77 StringDedupQueueFixup,
78 StringDedupTableFixup,
79 RedirtyCards,
80 YoungFreeCSet,
81 NonYoungFreeCSet,
82 GCParPhasesSentinel
83 };
84
85 enum GCScanRSWorkItems {
86 ScanRSScannedCards,
87 ScanRSClaimedCards,
88 ScanRSSkippedCards
89 };
90
91 enum GCUpdateRSWorkItems {
92 UpdateRSProcessedBuffers,
93 UpdateRSScannedCards,
94 UpdateRSSkippedCards
95 };
96
97 enum GCOptCSetWorkItems {
98 OptCSetScannedCards,
99 OptCSetClaimedCards,
100 OptCSetSkippedCards,
101 OptCSetUsedMemory
102 };
103
104 private:
105 // Markers for grouping the phases in the GCPhases enum above
106 static const int GCMainParPhasesLast = GCWorkerEnd;
107 static const int StringDedupPhasesFirst = StringDedupQueueFixup;
108 static const int StringDedupPhasesLast = StringDedupTableFixup;
109
110 WorkerDataArray<double>* _gc_par_phases[GCParPhasesSentinel];
111
112 WorkerDataArray<size_t>* _update_rs_processed_buffers;
113 WorkerDataArray<size_t>* _update_rs_scanned_cards;
114 WorkerDataArray<size_t>* _update_rs_skipped_cards;
115
116 WorkerDataArray<size_t>* _scan_rs_scanned_cards;
117 WorkerDataArray<size_t>* _scan_rs_claimed_cards;
118 WorkerDataArray<size_t>* _scan_rs_skipped_cards;
119
120 WorkerDataArray<size_t>* _opt_cset_scanned_cards;
121 WorkerDataArray<size_t>* _opt_cset_claimed_cards;
122 WorkerDataArray<size_t>* _opt_cset_skipped_cards;
123 WorkerDataArray<size_t>* _opt_cset_used_memory;
124
125 WorkerDataArray<size_t>* _termination_attempts;
126
127 WorkerDataArray<size_t>* _redirtied_cards;
128
129 double _cur_collection_par_time_ms;
130 double _cur_optional_evac_ms;
131 double _cur_collection_code_root_fixup_time_ms;
132 double _cur_strong_code_root_purge_time_ms;
133
134 double _cur_evac_fail_recalc_used;
135 double _cur_evac_fail_remove_self_forwards;
136
137 double _cur_string_dedup_fixup_time_ms;
138
139 double _cur_prepare_tlab_time_ms;
140 double _cur_resize_tlab_time_ms;
141
142 double _cur_derived_pointer_table_update_time_ms;
143
144 double _cur_clear_ct_time_ms;
145 double _cur_expand_heap_time_ms;
146 double _cur_ref_proc_time_ms;
147
148 double _cur_collection_start_sec;
149 double _root_region_scan_wait_time_ms;
150
182 double worker_time(GCParPhases phase, uint worker);
183 void note_gc_end();
184 void reset();
185
186 template <class T>
187 void details(T* phase, const char* indent) const;
188
189 void log_phase(WorkerDataArray<double>* phase, uint indent, outputStream* out, bool print_sum) const;
190 void debug_phase(WorkerDataArray<double>* phase) const;
191 void trace_phase(WorkerDataArray<double>* phase, bool print_sum = true) const;
192
193 void info_time(const char* name, double value) const;
194 void debug_time(const char* name, double value) const;
195 // This will print logs for both 'gc+phases' and 'gc+phases+ref'.
196 void debug_time_for_reference(const char* name, double value) const;
197 void trace_time(const char* name, double value) const;
198 void trace_count(const char* name, size_t value) const;
199
200 double print_pre_evacuate_collection_set() const;
201 double print_evacuate_collection_set() const;
202 double print_evacuate_optional_collection_set() const;
203 double print_post_evacuate_collection_set() const;
204 void print_other(double accounted_ms) const;
205
206 public:
207 G1GCPhaseTimes(STWGCTimer* gc_timer, uint max_gc_threads);
208 void note_gc_start();
209 void print();
210 static const char* phase_name(GCParPhases phase);
211
212 // record the time a phase took in seconds
213 void record_time_secs(GCParPhases phase, uint worker_i, double secs);
214
215 // add a number of seconds to a phase
216 void add_time_secs(GCParPhases phase, uint worker_i, double secs);
217
218 void record_or_add_time_secs(GCParPhases phase, uint worker_i, double secs);
219
220 void record_thread_work_item(GCParPhases phase, uint worker_i, size_t count, uint index = 0);
221
222 void record_or_add_thread_work_item(GCParPhases phase, uint worker_i, size_t count, uint index = 0);
223
224 // return the average time for a phase in milliseconds
225 double average_time_ms(GCParPhases phase);
226
227 size_t sum_thread_work_items(GCParPhases phase, uint index = 0);
228
229 public:
230
231 void record_prepare_tlab_time_ms(double ms) {
232 _cur_prepare_tlab_time_ms = ms;
233 }
234
235 void record_resize_tlab_time_ms(double ms) {
236 _cur_resize_tlab_time_ms = ms;
237 }
238
239 void record_derived_pointer_table_update_time(double ms) {
240 _cur_derived_pointer_table_update_time_ms = ms;
241 }
242
243 void record_clear_ct_time(double ms) {
244 _cur_clear_ct_time_ms = ms;
245 }
246
247 void record_expand_heap_time(double ms) {
248 _cur_expand_heap_time_ms = ms;
249 }
250
251 void record_par_time(double ms) {
252 _cur_collection_par_time_ms = ms;
253 }
254
255 void record_optional_evacuation(double ms) {
256 _cur_optional_evac_ms = ms;
257 }
258
259 void record_code_root_fixup_time(double ms) {
260 _cur_collection_code_root_fixup_time_ms = ms;
261 }
262
263 void record_strong_code_root_purge_time(double ms) {
264 _cur_strong_code_root_purge_time_ms = ms;
265 }
266
267 void record_evac_fail_recalc_used_time(double ms) {
268 _cur_evac_fail_recalc_used = ms;
269 }
270
271 void record_evac_fail_remove_self_forwards(double ms) {
272 _cur_evac_fail_remove_self_forwards = ms;
273 }
274
275 void record_string_dedup_fixup_time(double ms) {
276 _cur_string_dedup_fixup_time_ms = ms;
|