Print this page
JDK-8236073 G1: Use SoftMaxHeapSize to guide GC heuristics
Split |
Close |
Expand all |
Collapse all |
--- old/src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp
+++ new/src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp
1 1 /*
2 2 * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 4 *
5 5 * This code is free software; you can redistribute it and/or modify it
6 6 * under the terms of the GNU General Public License version 2 only, as
7 7 * published by the Free Software Foundation.
8 8 *
9 9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 12 * version 2 for more details (a copy is included in the LICENSE file that
13 13 * accompanied this code).
14 14 *
15 15 * You should have received a copy of the GNU General Public License version
16 16 * 2 along with this work; if not, write to the Free Software Foundation,
17 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 18 *
19 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 20 * or visit www.oracle.com if you need additional information or have any
21 21 * questions.
22 22 *
23 23 */
24 24
25 25 #ifndef SHARE_GC_G1_G1GCPHASETIMES_HPP
26 26 #define SHARE_GC_G1_G1GCPHASETIMES_HPP
27 27
28 28 #include "gc/shared/referenceProcessorPhaseTimes.hpp"
29 29 #include "gc/shared/weakProcessorPhaseTimes.hpp"
30 30 #include "jfr/jfrEvents.hpp"
31 31 #include "logging/logLevel.hpp"
32 32 #include "memory/allocation.hpp"
33 33 #include "utilities/macros.hpp"
34 34
35 35 class LineBuffer;
36 36 class G1ParScanThreadState;
37 37 class STWGCTimer;
38 38
39 39 template <class T> class WorkerDataArray;
40 40
41 41 class G1GCPhaseTimes : public CHeapObj<mtGC> {
42 42 uint _max_gc_threads;
43 43 jlong _gc_start_counter;
44 44 double _gc_pause_time_ms;
45 45
46 46 public:
47 47 enum GCParPhases {
48 48 GCWorkerStart,
49 49 ExtRootScan,
50 50 ThreadRoots,
51 51 UniverseRoots,
52 52 JNIRoots,
53 53 ObjectSynchronizerRoots,
54 54 ManagementRoots,
55 55 SystemDictionaryRoots,
56 56 CLDGRoots,
57 57 JVMTIRoots,
58 58 AOT_ONLY(AOTCodeRoots COMMA)
59 59 CMRefRoots,
60 60 MergeER,
61 61 MergeRS,
62 62 OptMergeRS,
63 63 MergeLB,
64 64 MergeHCC,
65 65 ScanHR,
66 66 OptScanHR,
67 67 CodeRoots,
68 68 OptCodeRoots,
69 69 ObjCopy,
70 70 OptObjCopy,
71 71 Termination,
72 72 OptTermination,
73 73 Other,
74 74 GCWorkerTotal,
75 75 GCWorkerEnd,
76 76 StringDedupQueueFixup,
77 77 StringDedupTableFixup,
78 78 RedirtyCards,
79 79 ParFreeCSet,
80 80 YoungFreeCSet,
81 81 NonYoungFreeCSet,
82 82 RebuildFreeList,
83 83 MergePSS,
84 84 GCParPhasesSentinel
85 85 };
86 86
87 87 static const GCParPhases ExtRootScanSubPhasesFirst = ThreadRoots;
88 88 static const GCParPhases ExtRootScanSubPhasesLast = CMRefRoots;
89 89
90 90 enum GCMergeRSWorkTimes {
91 91 MergeRSMergedSparse,
92 92 MergeRSMergedFine,
93 93 MergeRSMergedCoarse,
94 94 MergeRSDirtyCards
95 95 };
96 96
97 97 enum GCScanHRWorkItems {
98 98 ScanHRScannedCards,
99 99 ScanHRScannedBlocks,
100 100 ScanHRClaimedChunks,
101 101 ScanHRScannedOptRefs,
102 102 ScanHRUsedMemory
103 103 };
104 104
105 105 enum GCMergeHCCWorkItems {
106 106 MergeHCCDirtyCards,
107 107 MergeHCCSkippedCards
108 108 };
109 109
110 110 enum GCMergeLBWorkItems {
111 111 MergeLBDirtyCards,
112 112 MergeLBSkippedCards
113 113 };
114 114
115 115 enum GCMergePSSWorkItems {
116 116 MergePSSCopiedBytes,
117 117 MergePSSLABWasteBytes,
118 118 MergePSSLABUndoWasteBytes
119 119 };
120 120
121 121 private:
122 122 // Markers for grouping the phases in the GCPhases enum above
123 123 static const int GCMainParPhasesLast = GCWorkerEnd;
124 124
125 125 WorkerDataArray<double>* _gc_par_phases[GCParPhasesSentinel];
126 126
127 127 double _cur_collection_initial_evac_time_ms;
128 128 double _cur_optional_evac_time_ms;
129 129 double _cur_collection_code_root_fixup_time_ms;
130 130 double _cur_strong_code_root_purge_time_ms;
131 131
132 132 double _cur_evac_fail_recalc_used;
133 133 double _cur_evac_fail_remove_self_forwards;
134 134
135 135 double _cur_string_deduplication_time_ms;
136 136
137 137 double _cur_merge_heap_roots_time_ms;
138 138 double _cur_optional_merge_heap_roots_time_ms;
↓ open down ↓ |
138 lines elided |
↑ open up ↑ |
139 139
140 140 double _cur_prepare_merge_heap_roots_time_ms;
141 141 double _cur_optional_prepare_merge_heap_roots_time_ms;
142 142
143 143 double _cur_prepare_tlab_time_ms;
144 144 double _cur_resize_tlab_time_ms;
145 145
146 146 double _cur_derived_pointer_table_update_time_ms;
147 147
148 148 double _cur_clear_ct_time_ms;
149 - double _cur_expand_heap_time_ms;
149 + double _cur_resize_heap_time_ms;
150 150 double _cur_ref_proc_time_ms;
151 151
152 152 double _cur_collection_start_sec;
153 153 double _root_region_scan_wait_time_ms;
154 154
155 155 double _external_accounted_time_ms;
156 156
157 157 double _recorded_prepare_heap_roots_time_ms;
158 158
159 159 double _recorded_clear_claimed_marks_time_ms;
160 160
161 161 double _recorded_young_cset_choice_time_ms;
162 162 double _recorded_non_young_cset_choice_time_ms;
163 163
164 164 double _recorded_redirty_logged_cards_time_ms;
165 165
166 166 double _recorded_preserve_cm_referents_time_ms;
167 167
168 168 double _recorded_merge_pss_time_ms;
169 169
170 170 double _recorded_start_new_cset_time_ms;
171 171
172 172 double _recorded_total_free_cset_time_ms;
173 173
174 174 double _recorded_serial_free_cset_time_ms;
175 175
176 176 double _recorded_total_rebuild_freelist_time_ms;
177 177
178 178 double _recorded_serial_rebuild_freelist_time_ms;
179 179
180 180 double _cur_region_register_time;
181 181
182 182 double _cur_fast_reclaim_humongous_time_ms;
183 183 size_t _cur_fast_reclaim_humongous_total;
184 184 size_t _cur_fast_reclaim_humongous_candidates;
185 185 size_t _cur_fast_reclaim_humongous_reclaimed;
186 186
187 187 double _cur_verify_before_time_ms;
188 188 double _cur_verify_after_time_ms;
189 189
190 190 ReferenceProcessorPhaseTimes _ref_phase_times;
191 191 WeakProcessorPhaseTimes _weak_phase_times;
192 192
193 193 double worker_time(GCParPhases phase, uint worker);
194 194 void note_gc_end();
195 195 void reset();
196 196
197 197 template <class T>
198 198 void details(T* phase, const char* indent_str) const;
199 199
200 200 void log_work_items(WorkerDataArray<double>* phase, uint indent, outputStream* out) const;
201 201 void log_phase(WorkerDataArray<double>* phase, uint indent_level, outputStream* out, bool print_sum) const;
202 202 void debug_serial_phase(WorkerDataArray<double>* phase, uint extra_indent = 0) const;
203 203 void debug_phase(WorkerDataArray<double>* phase, uint extra_indent = 0) const;
204 204 void trace_phase(WorkerDataArray<double>* phase, bool print_sum = true, uint extra_indent = 0) const;
205 205
206 206 void info_time(const char* name, double value) const;
207 207 void debug_time(const char* name, double value) const;
208 208 // This will print logs for both 'gc+phases' and 'gc+phases+ref'.
209 209 void debug_time_for_reference(const char* name, double value) const;
210 210 void trace_time(const char* name, double value) const;
211 211 void trace_count(const char* name, size_t value) const;
212 212
213 213 double print_pre_evacuate_collection_set() const;
214 214 double print_merge_heap_roots_time() const;
215 215 double print_evacuate_initial_collection_set() const;
216 216 double print_evacuate_optional_collection_set() const;
217 217 double print_post_evacuate_collection_set() const;
218 218 void print_other(double accounted_ms) const;
219 219
220 220 public:
221 221 G1GCPhaseTimes(STWGCTimer* gc_timer, uint max_gc_threads);
222 222 void note_gc_start();
223 223 void print();
224 224 static const char* phase_name(GCParPhases phase);
225 225
226 226 // record the time a phase took in seconds
227 227 void record_time_secs(GCParPhases phase, uint worker_id, double secs);
228 228
229 229 // add a number of seconds to a phase
230 230 void add_time_secs(GCParPhases phase, uint worker_id, double secs);
231 231
232 232 void record_or_add_time_secs(GCParPhases phase, uint worker_id, double secs);
233 233
234 234 double get_time_secs(GCParPhases phase, uint worker_id);
235 235
236 236 void record_thread_work_item(GCParPhases phase, uint worker_id, size_t count, uint index = 0);
237 237
238 238 void record_or_add_thread_work_item(GCParPhases phase, uint worker_id, size_t count, uint index = 0);
239 239
240 240 size_t get_thread_work_item(GCParPhases phase, uint worker_id, uint index = 0);
241 241
242 242 // return the average time for a phase in milliseconds
243 243 double average_time_ms(GCParPhases phase);
244 244
245 245 size_t sum_thread_work_items(GCParPhases phase, uint index = 0);
246 246
247 247 void record_prepare_tlab_time_ms(double ms) {
248 248 _cur_prepare_tlab_time_ms = ms;
249 249 }
250 250
251 251 void record_resize_tlab_time_ms(double ms) {
252 252 _cur_resize_tlab_time_ms = ms;
↓ open down ↓ |
93 lines elided |
↑ open up ↑ |
253 253 }
254 254
255 255 void record_derived_pointer_table_update_time(double ms) {
256 256 _cur_derived_pointer_table_update_time_ms = ms;
257 257 }
258 258
259 259 void record_clear_ct_time(double ms) {
260 260 _cur_clear_ct_time_ms = ms;
261 261 }
262 262
263 - void record_expand_heap_time(double ms) {
264 - _cur_expand_heap_time_ms = ms;
263 + void record_resize_heap_time(double ms) {
264 + _cur_resize_heap_time_ms = ms;
265 265 }
266 266
267 267 void record_initial_evac_time(double ms) {
268 268 _cur_collection_initial_evac_time_ms = ms;
269 269 }
270 270
271 271 void record_or_add_optional_evac_time(double ms) {
272 272 _cur_optional_evac_time_ms += ms;
273 273 }
274 274
275 275 void record_or_add_code_root_fixup_time(double ms) {
276 276 _cur_collection_code_root_fixup_time_ms += ms;
277 277 }
278 278
279 279 void record_strong_code_root_purge_time(double ms) {
280 280 _cur_strong_code_root_purge_time_ms = ms;
281 281 }
282 282
283 283 void record_merge_heap_roots_time(double ms) {
284 284 _cur_merge_heap_roots_time_ms += ms;
285 285 }
286 286
287 287 void record_or_add_optional_merge_heap_roots_time(double ms) {
288 288 _cur_optional_merge_heap_roots_time_ms += ms;
289 289 }
290 290
291 291 void record_prepare_merge_heap_roots_time(double ms) {
292 292 _cur_prepare_merge_heap_roots_time_ms += ms;
293 293 }
294 294
295 295 void record_or_add_optional_prepare_merge_heap_roots_time(double ms) {
296 296 _cur_optional_prepare_merge_heap_roots_time_ms += ms;
297 297 }
298 298
299 299 void record_evac_fail_recalc_used_time(double ms) {
300 300 _cur_evac_fail_recalc_used = ms;
301 301 }
302 302
303 303 void record_evac_fail_remove_self_forwards(double ms) {
304 304 _cur_evac_fail_remove_self_forwards = ms;
305 305 }
306 306
307 307 void record_string_deduplication_time(double ms) {
308 308 _cur_string_deduplication_time_ms = ms;
309 309 }
310 310
311 311 void record_ref_proc_time(double ms) {
312 312 _cur_ref_proc_time_ms = ms;
313 313 }
314 314
315 315 void record_root_region_scan_wait_time(double time_ms) {
316 316 _root_region_scan_wait_time_ms = time_ms;
317 317 }
318 318
319 319 void record_total_free_cset_time_ms(double time_ms) {
320 320 _recorded_total_free_cset_time_ms = time_ms;
321 321 }
322 322
323 323 void record_serial_free_cset_time_ms(double time_ms) {
324 324 _recorded_serial_free_cset_time_ms = time_ms;
325 325 }
326 326
327 327 void record_total_rebuild_freelist_time_ms(double time_ms) {
328 328 _recorded_total_rebuild_freelist_time_ms = time_ms;
329 329 }
330 330
331 331 void record_serial_rebuild_freelist_time_ms(double time_ms) {
332 332 _recorded_serial_rebuild_freelist_time_ms = time_ms;
333 333 }
334 334
335 335 void record_register_regions(double time_ms, size_t total, size_t candidates) {
336 336 _cur_region_register_time = time_ms;
337 337 _cur_fast_reclaim_humongous_total = total;
338 338 _cur_fast_reclaim_humongous_candidates = candidates;
339 339 }
340 340
341 341 void record_fast_reclaim_humongous_time_ms(double value, size_t reclaimed) {
342 342 _cur_fast_reclaim_humongous_time_ms = value;
343 343 _cur_fast_reclaim_humongous_reclaimed = reclaimed;
344 344 }
345 345
346 346 void record_young_cset_choice_time_ms(double time_ms) {
347 347 _recorded_young_cset_choice_time_ms = time_ms;
348 348 }
349 349
350 350 void record_non_young_cset_choice_time_ms(double time_ms) {
351 351 _recorded_non_young_cset_choice_time_ms = time_ms;
352 352 }
353 353
354 354 void record_redirty_logged_cards_time_ms(double time_ms) {
355 355 _recorded_redirty_logged_cards_time_ms = time_ms;
356 356 }
357 357
358 358 void record_preserve_cm_referents_time_ms(double time_ms) {
359 359 _recorded_preserve_cm_referents_time_ms = time_ms;
360 360 }
361 361
362 362 void record_start_new_cset_time_ms(double time_ms) {
363 363 _recorded_start_new_cset_time_ms = time_ms;
364 364 }
365 365
366 366 void record_cur_collection_start_sec(double time_ms) {
367 367 _cur_collection_start_sec = time_ms;
368 368 }
369 369
370 370 void record_verify_before_time_ms(double time_ms) {
371 371 _cur_verify_before_time_ms = time_ms;
372 372 }
373 373
374 374 void record_verify_after_time_ms(double time_ms) {
375 375 _cur_verify_after_time_ms = time_ms;
376 376 }
377 377
378 378 void inc_external_accounted_time_ms(double time_ms) {
379 379 _external_accounted_time_ms += time_ms;
380 380 }
381 381
382 382 void record_prepare_heap_roots_time_ms(double recorded_prepare_heap_roots_time_ms) {
383 383 _recorded_prepare_heap_roots_time_ms = recorded_prepare_heap_roots_time_ms;
384 384 }
385 385
386 386 void record_clear_claimed_marks_time_ms(double recorded_clear_claimed_marks_time_ms) {
387 387 _recorded_clear_claimed_marks_time_ms = recorded_clear_claimed_marks_time_ms;
388 388 }
389 389
390 390 double cur_collection_start_sec() {
391 391 return _cur_collection_start_sec;
↓ open down ↓ |
117 lines elided |
↑ open up ↑ |
392 392 }
393 393
394 394 double cur_collection_par_time_ms() {
395 395 return _cur_collection_initial_evac_time_ms + _cur_optional_evac_time_ms;
396 396 }
397 397
398 398 double cur_clear_ct_time_ms() {
399 399 return _cur_clear_ct_time_ms;
400 400 }
401 401
402 - double cur_expand_heap_time_ms() {
403 - return _cur_expand_heap_time_ms;
402 + double cur_resize_heap_time_ms() {
403 + return _cur_resize_heap_time_ms;
404 404 }
405 405
406 406 double root_region_scan_wait_time_ms() {
407 407 return _root_region_scan_wait_time_ms;
408 408 }
409 409
410 410 double young_cset_choice_time_ms() {
411 411 return _recorded_young_cset_choice_time_ms;
412 412 }
413 413
414 414 double total_free_cset_time_ms() {
415 415 return _recorded_total_free_cset_time_ms;
416 416 }
417 417
418 418 double total_rebuild_freelist_time_ms() {
419 419 return _recorded_total_rebuild_freelist_time_ms;
420 420 }
421 421
422 422 double non_young_cset_choice_time_ms() {
423 423 return _recorded_non_young_cset_choice_time_ms;
424 424 }
425 425
426 426 double fast_reclaim_humongous_time_ms() {
427 427 return _cur_fast_reclaim_humongous_time_ms;
428 428 }
429 429
430 430 size_t fast_reclaim_humongous_candidates() const {
431 431 return _cur_fast_reclaim_humongous_candidates;
432 432 }
433 433
434 434 ReferenceProcessorPhaseTimes* ref_phase_times() { return &_ref_phase_times; }
435 435
436 436 WeakProcessorPhaseTimes* weak_phase_times() { return &_weak_phase_times; }
437 437 };
438 438
439 439 class G1EvacPhaseWithTrimTimeTracker : public StackObj {
440 440 G1ParScanThreadState* _pss;
441 441 Ticks _start;
442 442
443 443 Tickspan& _total_time;
444 444 Tickspan& _trim_time;
445 445
446 446 bool _stopped;
447 447 public:
448 448 G1EvacPhaseWithTrimTimeTracker(G1ParScanThreadState* pss, Tickspan& total_time, Tickspan& trim_time);
449 449 ~G1EvacPhaseWithTrimTimeTracker();
450 450
451 451 void stop();
452 452 };
453 453
454 454 class G1GCParPhaseTimesTracker : public CHeapObj<mtGC> {
455 455 protected:
456 456 Ticks _start_time;
457 457 G1GCPhaseTimes::GCParPhases _phase;
458 458 G1GCPhaseTimes* _phase_times;
459 459 uint _worker_id;
460 460 EventGCPhaseParallel _event;
461 461 bool _must_record;
462 462
463 463 public:
464 464 G1GCParPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1GCPhaseTimes::GCParPhases phase, uint worker_id, bool must_record = true);
465 465 virtual ~G1GCParPhaseTimesTracker();
466 466 };
467 467
468 468 class G1EvacPhaseTimesTracker : public G1GCParPhaseTimesTracker {
469 469 Tickspan _total_time;
470 470 Tickspan _trim_time;
471 471
472 472 G1EvacPhaseWithTrimTimeTracker _trim_tracker;
473 473 public:
474 474 G1EvacPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1ParScanThreadState* pss, G1GCPhaseTimes::GCParPhases phase, uint worker_id);
475 475 virtual ~G1EvacPhaseTimesTracker();
476 476 };
477 477
478 478 #endif // SHARE_GC_G1_G1GCPHASETIMES_HPP
↓ open down ↓ |
65 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX