50 ThreadRoots,
51 UniverseRoots,
52 JNIRoots,
53 ObjectSynchronizerRoots,
54 ManagementRoots,
55 SystemDictionaryRoots,
56 CLDGRoots,
57 JVMTIRoots,
58 #if INCLUDE_AOT
59 AOTCodeRoots,
60 #endif
61 CMRefRoots,
62 WaitForStrongCLD,
63 WeakCLDRoots,
64 SATBFiltering,
65 UpdateRS,
66 ScanHCC,
67 ScanRS,
68 OptScanRS,
69 CodeRoots,
70 ObjCopy,
71 OptObjCopy,
72 Termination,
73 Other,
74 GCWorkerTotal,
75 GCWorkerEnd,
76 StringDedupQueueFixup,
77 StringDedupTableFixup,
78 RedirtyCards,
79 YoungFreeCSet,
80 NonYoungFreeCSet,
81 GCParPhasesSentinel
82 };
83
84 static const GCParPhases ExtRootScanSubPhasesStart = ThreadRoots;
85 static const GCParPhases ExtRootScanSubPhasesEnd = SATBFiltering;
86
87 enum GCScanRSWorkItems {
88 ScanRSScannedCards,
89 ScanRSClaimedCards,
90 ScanRSSkippedCards
91 };
92
93 enum GCUpdateRSWorkItems {
94 UpdateRSProcessedBuffers,
95 UpdateRSScannedCards,
96 UpdateRSSkippedCards
97 };
98
99 enum GCObjCopyWorkItems {
100 ObjCopyLABWaste,
101 ObjCopyLABUndoWaste
102 };
103
104 enum GCOptCSetWorkItems {
105 OptCSetScannedCards,
106 OptCSetClaimedCards,
107 OptCSetSkippedCards,
108 OptCSetUsedMemory
109 };
110
111 private:
112 // Markers for grouping the phases in the GCPhases enum above
113 static const int GCMainParPhasesLast = GCWorkerEnd;
114
115 WorkerDataArray<double>* _gc_par_phases[GCParPhasesSentinel];
116
117 WorkerDataArray<size_t>* _update_rs_processed_buffers;
118 WorkerDataArray<size_t>* _update_rs_scanned_cards;
119 WorkerDataArray<size_t>* _update_rs_skipped_cards;
120
121 WorkerDataArray<size_t>* _scan_rs_scanned_cards;
122 WorkerDataArray<size_t>* _scan_rs_claimed_cards;
123 WorkerDataArray<size_t>* _scan_rs_skipped_cards;
124
125 WorkerDataArray<size_t>* _obj_copy_lab_waste;
126 WorkerDataArray<size_t>* _obj_copy_lab_undo_waste;
127
128 WorkerDataArray<size_t>* _opt_cset_scanned_cards;
129 WorkerDataArray<size_t>* _opt_cset_claimed_cards;
130 WorkerDataArray<size_t>* _opt_cset_skipped_cards;
131 WorkerDataArray<size_t>* _opt_cset_used_memory;
132
133 WorkerDataArray<size_t>* _termination_attempts;
134
135 WorkerDataArray<size_t>* _redirtied_cards;
136
137 double _cur_collection_par_time_ms;
138 double _cur_optional_evac_ms;
139 double _cur_collection_code_root_fixup_time_ms;
140 double _cur_strong_code_root_purge_time_ms;
141
142 double _cur_evac_fail_recalc_used;
143 double _cur_evac_fail_remove_self_forwards;
144
145 double _cur_string_deduplication_time_ms;
146
147 double _cur_prepare_tlab_time_ms;
148 double _cur_resize_tlab_time_ms;
149
150 double _cur_derived_pointer_table_update_time_ms;
151
152 double _cur_clear_ct_time_ms;
153 double _cur_expand_heap_time_ms;
154 double _cur_ref_proc_time_ms;
155
156 double _cur_collection_start_sec;
157 double _root_region_scan_wait_time_ms;
208 double print_pre_evacuate_collection_set() const;
209 double print_evacuate_collection_set() const;
210 double print_evacuate_optional_collection_set() const;
211 double print_post_evacuate_collection_set() const;
212 void print_other(double accounted_ms) const;
213
214 public:
215 G1GCPhaseTimes(STWGCTimer* gc_timer, uint max_gc_threads);
216 void note_gc_start();
217 void print();
218 static const char* phase_name(GCParPhases phase);
219
220 // record the time a phase took in seconds
221 void record_time_secs(GCParPhases phase, uint worker_i, double secs);
222
223 // add a number of seconds to a phase
224 void add_time_secs(GCParPhases phase, uint worker_i, double secs);
225
226 void record_or_add_time_secs(GCParPhases phase, uint worker_i, double secs);
227
228 void record_thread_work_item(GCParPhases phase, uint worker_i, size_t count, uint index = 0);
229
230 void record_or_add_thread_work_item(GCParPhases phase, uint worker_i, size_t count, uint index = 0);
231
232 // return the average time for a phase in milliseconds
233 double average_time_ms(GCParPhases phase);
234
235 size_t sum_thread_work_items(GCParPhases phase, uint index = 0);
236
237 public:
238
239 void record_prepare_tlab_time_ms(double ms) {
240 _cur_prepare_tlab_time_ms = ms;
241 }
242
243 void record_resize_tlab_time_ms(double ms) {
244 _cur_resize_tlab_time_ms = ms;
245 }
246
247 void record_derived_pointer_table_update_time(double ms) {
248 _cur_derived_pointer_table_update_time_ms = ms;
249 }
250
251 void record_clear_ct_time(double ms) {
252 _cur_clear_ct_time_ms = ms;
253 }
254
255 void record_expand_heap_time(double ms) {
256 _cur_expand_heap_time_ms = ms;
257 }
258
259 void record_par_time(double ms) {
260 _cur_collection_par_time_ms = ms;
261 }
262
263 void record_optional_evacuation(double ms) {
264 _cur_optional_evac_ms = ms;
265 }
266
267 void record_code_root_fixup_time(double ms) {
268 _cur_collection_code_root_fixup_time_ms = ms;
269 }
270
271 void record_strong_code_root_purge_time(double ms) {
272 _cur_strong_code_root_purge_time_ms = ms;
273 }
274
275 void record_evac_fail_recalc_used_time(double ms) {
276 _cur_evac_fail_recalc_used = ms;
277 }
278
279 void record_evac_fail_remove_self_forwards(double ms) {
280 _cur_evac_fail_remove_self_forwards = ms;
281 }
282
283 void record_string_deduplication_time(double ms) {
284 _cur_string_deduplication_time_ms = ms;
285 }
286
287 void record_ref_proc_time(double ms) {
288 _cur_ref_proc_time_ms = ms;
343 _cur_verify_before_time_ms = time_ms;
344 }
345
346 void record_verify_after_time_ms(double time_ms) {
347 _cur_verify_after_time_ms = time_ms;
348 }
349
350 void inc_external_accounted_time_ms(double time_ms) {
351 _external_accounted_time_ms += time_ms;
352 }
353
354 void record_clear_claimed_marks_time_ms(double recorded_clear_claimed_marks_time_ms) {
355 _recorded_clear_claimed_marks_time_ms = recorded_clear_claimed_marks_time_ms;
356 }
357
358 double cur_collection_start_sec() {
359 return _cur_collection_start_sec;
360 }
361
362 double cur_collection_par_time_ms() {
363 return _cur_collection_par_time_ms;
364 }
365
366 double cur_clear_ct_time_ms() {
367 return _cur_clear_ct_time_ms;
368 }
369
370 double cur_expand_heap_time_ms() {
371 return _cur_expand_heap_time_ms;
372 }
373
374 double root_region_scan_wait_time_ms() {
375 return _root_region_scan_wait_time_ms;
376 }
377
378 double young_cset_choice_time_ms() {
379 return _recorded_young_cset_choice_time_ms;
380 }
381
382 double total_free_cset_time_ms() {
383 return _recorded_total_free_cset_time_ms;
|
50 ThreadRoots,
51 UniverseRoots,
52 JNIRoots,
53 ObjectSynchronizerRoots,
54 ManagementRoots,
55 SystemDictionaryRoots,
56 CLDGRoots,
57 JVMTIRoots,
58 #if INCLUDE_AOT
59 AOTCodeRoots,
60 #endif
61 CMRefRoots,
62 WaitForStrongCLD,
63 WeakCLDRoots,
64 SATBFiltering,
65 UpdateRS,
66 ScanHCC,
67 ScanRS,
68 OptScanRS,
69 CodeRoots,
70 OptCodeRoots,
71 ObjCopy,
72 OptObjCopy,
73 Termination,
74 OptTermination,
75 Other,
76 GCWorkerTotal,
77 GCWorkerEnd,
78 StringDedupQueueFixup,
79 StringDedupTableFixup,
80 RedirtyCards,
81 YoungFreeCSet,
82 NonYoungFreeCSet,
83 GCParPhasesSentinel
84 };
85
86 static const GCParPhases ExtRootScanSubPhasesStart = ThreadRoots;
87 static const GCParPhases ExtRootScanSubPhasesEnd = SATBFiltering;
88
89 enum GCScanRSWorkItems {
90 ScanRSScannedCards,
91 ScanRSClaimedCards,
92 ScanRSSkippedCards,
93 ScanRSScannedOptRefs,
94 ScanRSUsedMemory
95 };
96
97 enum GCUpdateRSWorkItems {
98 UpdateRSProcessedBuffers,
99 UpdateRSScannedCards,
100 UpdateRSSkippedCards
101 };
102
103 enum GCObjCopyWorkItems {
104 ObjCopyLABWaste,
105 ObjCopyLABUndoWaste
106 };
107
108 private:
109 // Markers for grouping the phases in the GCPhases enum above
110 static const int GCMainParPhasesLast = GCWorkerEnd;
111
112 WorkerDataArray<double>* _gc_par_phases[GCParPhasesSentinel];
113
114 WorkerDataArray<size_t>* _update_rs_processed_buffers;
115 WorkerDataArray<size_t>* _update_rs_scanned_cards;
116 WorkerDataArray<size_t>* _update_rs_skipped_cards;
117
118 WorkerDataArray<size_t>* _scan_rs_scanned_cards;
119 WorkerDataArray<size_t>* _scan_rs_claimed_cards;
120 WorkerDataArray<size_t>* _scan_rs_skipped_cards;
121
122 WorkerDataArray<size_t>* _opt_scan_rs_scanned_cards;
123 WorkerDataArray<size_t>* _opt_scan_rs_claimed_cards;
124 WorkerDataArray<size_t>* _opt_scan_rs_skipped_cards;
125 WorkerDataArray<size_t>* _opt_scan_rs_scanned_opt_refs;
126 WorkerDataArray<size_t>* _opt_scan_rs_used_memory;
127
128 WorkerDataArray<size_t>* _obj_copy_lab_waste;
129 WorkerDataArray<size_t>* _obj_copy_lab_undo_waste;
130
131 WorkerDataArray<size_t>* _opt_obj_copy_lab_waste;
132 WorkerDataArray<size_t>* _opt_obj_copy_lab_undo_waste;
133
134 WorkerDataArray<size_t>* _termination_attempts;
135
136 WorkerDataArray<size_t>* _opt_termination_attempts;
137
138 WorkerDataArray<size_t>* _redirtied_cards;
139
140 double _cur_collection_initial_evac_time_ms;
141 double _cur_optional_evac_ms;
142 double _cur_collection_code_root_fixup_time_ms;
143 double _cur_strong_code_root_purge_time_ms;
144
145 double _cur_evac_fail_recalc_used;
146 double _cur_evac_fail_remove_self_forwards;
147
148 double _cur_string_deduplication_time_ms;
149
150 double _cur_prepare_tlab_time_ms;
151 double _cur_resize_tlab_time_ms;
152
153 double _cur_derived_pointer_table_update_time_ms;
154
155 double _cur_clear_ct_time_ms;
156 double _cur_expand_heap_time_ms;
157 double _cur_ref_proc_time_ms;
158
159 double _cur_collection_start_sec;
160 double _root_region_scan_wait_time_ms;
211 double print_pre_evacuate_collection_set() const;
212 double print_evacuate_collection_set() const;
213 double print_evacuate_optional_collection_set() const;
214 double print_post_evacuate_collection_set() const;
215 void print_other(double accounted_ms) const;
216
217 public:
218 G1GCPhaseTimes(STWGCTimer* gc_timer, uint max_gc_threads);
219 void note_gc_start();
220 void print();
221 static const char* phase_name(GCParPhases phase);
222
223 // record the time a phase took in seconds
224 void record_time_secs(GCParPhases phase, uint worker_i, double secs);
225
226 // add a number of seconds to a phase
227 void add_time_secs(GCParPhases phase, uint worker_i, double secs);
228
229 void record_or_add_time_secs(GCParPhases phase, uint worker_i, double secs);
230
231 double get_time_secs(GCParPhases phase, uint worker_i);
232
233 void record_thread_work_item(GCParPhases phase, uint worker_i, size_t count, uint index = 0);
234
235 void record_or_add_thread_work_item(GCParPhases phase, uint worker_i, size_t count, uint index = 0);
236
237 size_t get_thread_work_item(GCParPhases phase, uint worker_i, uint index = 0);
238
239 // return the average time for a phase in milliseconds
240 double average_time_ms(GCParPhases phase);
241
242 size_t sum_thread_work_items(GCParPhases phase, uint index = 0);
243
244 public:
245
246 void record_prepare_tlab_time_ms(double ms) {
247 _cur_prepare_tlab_time_ms = ms;
248 }
249
250 void record_resize_tlab_time_ms(double ms) {
251 _cur_resize_tlab_time_ms = ms;
252 }
253
254 void record_derived_pointer_table_update_time(double ms) {
255 _cur_derived_pointer_table_update_time_ms = ms;
256 }
257
258 void record_clear_ct_time(double ms) {
259 _cur_clear_ct_time_ms = ms;
260 }
261
262 void record_expand_heap_time(double ms) {
263 _cur_expand_heap_time_ms = ms;
264 }
265
266 void record_or_add_initial_evac_time(double ms) {
267 _cur_collection_initial_evac_time_ms += ms;
268 }
269
270 void record_optional_evacuation(double ms) {
271 _cur_optional_evac_ms = ms;
272 }
273
274 void record_or_add_code_root_fixup_time(double ms) {
275 _cur_collection_code_root_fixup_time_ms += ms;
276 }
277
278 void record_strong_code_root_purge_time(double ms) {
279 _cur_strong_code_root_purge_time_ms = ms;
280 }
281
282 void record_evac_fail_recalc_used_time(double ms) {
283 _cur_evac_fail_recalc_used = ms;
284 }
285
286 void record_evac_fail_remove_self_forwards(double ms) {
287 _cur_evac_fail_remove_self_forwards = ms;
288 }
289
290 void record_string_deduplication_time(double ms) {
291 _cur_string_deduplication_time_ms = ms;
292 }
293
294 void record_ref_proc_time(double ms) {
295 _cur_ref_proc_time_ms = ms;
350 _cur_verify_before_time_ms = time_ms;
351 }
352
353 void record_verify_after_time_ms(double time_ms) {
354 _cur_verify_after_time_ms = time_ms;
355 }
356
357 void inc_external_accounted_time_ms(double time_ms) {
358 _external_accounted_time_ms += time_ms;
359 }
360
361 void record_clear_claimed_marks_time_ms(double recorded_clear_claimed_marks_time_ms) {
362 _recorded_clear_claimed_marks_time_ms = recorded_clear_claimed_marks_time_ms;
363 }
364
365 double cur_collection_start_sec() {
366 return _cur_collection_start_sec;
367 }
368
369 double cur_collection_par_time_ms() {
370 return _cur_collection_initial_evac_time_ms;
371 }
372
373 double cur_clear_ct_time_ms() {
374 return _cur_clear_ct_time_ms;
375 }
376
377 double cur_expand_heap_time_ms() {
378 return _cur_expand_heap_time_ms;
379 }
380
381 double root_region_scan_wait_time_ms() {
382 return _root_region_scan_wait_time_ms;
383 }
384
385 double young_cset_choice_time_ms() {
386 return _recorded_young_cset_choice_time_ms;
387 }
388
389 double total_free_cset_time_ms() {
390 return _recorded_total_free_cset_time_ms;
|