rev 13242 : imported patch 8183539-remove-into-cset-dcqs rev 13243 : [mq]: 8183121-add-information-about-scanned-skipped-cards-during-updaters
1 /* 2 * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #ifndef SHARE_VM_GC_G1_G1GCPHASETIMES_HPP 26 #define SHARE_VM_GC_G1_G1GCPHASETIMES_HPP 27 28 #include "logging/logLevel.hpp" 29 #include "memory/allocation.hpp" 30 31 class LineBuffer; 32 33 template <class T> class WorkerDataArray; 34 35 class G1GCPhaseTimes : public CHeapObj<mtGC> { 36 uint _max_gc_threads; 37 jlong _gc_start_counter; 38 double _gc_pause_time_ms; 39 40 public: 41 enum GCParPhases { 42 GCWorkerStart, 43 ExtRootScan, 44 ThreadRoots, 45 StringTableRoots, 46 UniverseRoots, 47 JNIRoots, 48 ObjectSynchronizerRoots, 49 FlatProfilerRoots, 50 ManagementRoots, 51 SystemDictionaryRoots, 52 CLDGRoots, 53 JVMTIRoots, 54 CMRefRoots, 55 WaitForStrongCLD, 56 WeakCLDRoots, 57 SATBFiltering, 58 UpdateRS, 59 ScanHCC, 60 ScanRS, 61 CodeRoots, 62 #if INCLUDE_AOT 63 AOTCodeRoots, 64 #endif 65 ObjCopy, 66 Termination, 67 Other, 68 GCWorkerTotal, 69 GCWorkerEnd, 70 StringDedupQueueFixup, 71 StringDedupTableFixup, 72 RedirtyCards, 73 PreserveCMReferents, 74 YoungFreeCSet, 75 NonYoungFreeCSet, 76 GCParPhasesSentinel 77 }; 78 79 enum GCScanRSWorkItems { 80 ScannedCards, 81 ClaimedCards, 82 SkippedCards 83 }; 84 85 private: 86 // Markers for grouping the phases in the GCPhases enum above 87 static const int GCMainParPhasesLast = GCWorkerEnd; 88 static const int StringDedupPhasesFirst = StringDedupQueueFixup; 89 static const int StringDedupPhasesLast = StringDedupTableFixup; 90 91 WorkerDataArray<double>* _gc_par_phases[GCParPhasesSentinel]; 92 93 WorkerDataArray<size_t>* _update_rs_processed_buffers; 94 95 WorkerDataArray<size_t>* _scan_rs_scanned_cards; 96 WorkerDataArray<size_t>* _scan_rs_claimed_cards; 97 WorkerDataArray<size_t>* _scan_rs_skipped_cards; 98 99 WorkerDataArray<size_t>* _termination_attempts; 100 101 WorkerDataArray<size_t>* _redirtied_cards; 102 103 double _cur_collection_par_time_ms; 104 double _cur_collection_code_root_fixup_time_ms; 105 double _cur_strong_code_root_purge_time_ms; 106 107 double _cur_evac_fail_recalc_used; 108 double _cur_evac_fail_remove_self_forwards; 109 110 double _cur_string_dedup_fixup_time_ms; 111 112 double _cur_prepare_tlab_time_ms; 113 double _cur_resize_tlab_time_ms; 114 115 double _cur_derived_pointer_table_update_time_ms; 116 117 double _cur_clear_ct_time_ms; 118 double _cur_expand_heap_time_ms; 119 double _cur_ref_proc_time_ms; 120 double _cur_ref_enq_time_ms; 121 122 double _cur_collection_start_sec; 123 double _root_region_scan_wait_time_ms; 124 125 double _external_accounted_time_ms; 126 127 double _recorded_clear_claimed_marks_time_ms; 128 129 double _recorded_young_cset_choice_time_ms; 130 double _recorded_non_young_cset_choice_time_ms; 131 132 double _recorded_redirty_logged_cards_time_ms; 133 134 double _recorded_preserve_cm_referents_time_ms; 135 136 double _recorded_merge_pss_time_ms; 137 138 double _recorded_start_new_cset_time_ms; 139 140 double _recorded_total_free_cset_time_ms; 141 142 double _recorded_serial_free_cset_time_ms; 143 144 double _cur_fast_reclaim_humongous_time_ms; 145 double _cur_fast_reclaim_humongous_register_time_ms; 146 size_t _cur_fast_reclaim_humongous_total; 147 size_t _cur_fast_reclaim_humongous_candidates; 148 size_t _cur_fast_reclaim_humongous_reclaimed; 149 150 double _cur_verify_before_time_ms; 151 double _cur_verify_after_time_ms; 152 153 double worker_time(GCParPhases phase, uint worker); 154 void note_gc_end(); 155 void reset(); 156 157 template <class T> 158 void details(T* phase, const char* indent) const; 159 160 void log_phase(WorkerDataArray<double>* phase, uint indent, outputStream* out, bool print_sum) const; 161 void debug_phase(WorkerDataArray<double>* phase) const; 162 void trace_phase(WorkerDataArray<double>* phase, bool print_sum = true) const; 163 164 void info_time(const char* name, double value) const; 165 void debug_time(const char* name, double value) const; 166 void trace_time(const char* name, double value) const; 167 void trace_count(const char* name, size_t value) const; 168 169 double print_pre_evacuate_collection_set() const; 170 double print_evacuate_collection_set() const; 171 double print_post_evacuate_collection_set() const; 172 void print_other(double accounted_ms) const; 173 174 public: 175 G1GCPhaseTimes(uint max_gc_threads); 176 void note_gc_start(); 177 void print(); 178 179 // record the time a phase took in seconds 180 void record_time_secs(GCParPhases phase, uint worker_i, double secs); 181 182 // add a number of seconds to a phase 183 void add_time_secs(GCParPhases phase, uint worker_i, double secs); 184 185 void record_thread_work_item(GCParPhases phase, uint worker_i, size_t count, uint index = 0); 186 187 // return the average time for a phase in milliseconds 188 double average_time_ms(GCParPhases phase); 189 190 size_t sum_thread_work_items(GCParPhases phase, uint index = 0); 191 192 public: 193 194 void record_prepare_tlab_time_ms(double ms) { 195 _cur_prepare_tlab_time_ms = ms; 196 } 197 198 void record_resize_tlab_time_ms(double ms) { 199 _cur_resize_tlab_time_ms = ms; 200 } 201 202 void record_derived_pointer_table_update_time(double ms) { 203 _cur_derived_pointer_table_update_time_ms = ms; 204 } 205 206 void record_clear_ct_time(double ms) { 207 _cur_clear_ct_time_ms = ms; 208 } 209 210 void record_expand_heap_time(double ms) { 211 _cur_expand_heap_time_ms = ms; 212 } 213 214 void record_par_time(double ms) { 215 _cur_collection_par_time_ms = ms; 216 } 217 218 void record_code_root_fixup_time(double ms) { 219 _cur_collection_code_root_fixup_time_ms = ms; 220 } 221 222 void record_strong_code_root_purge_time(double ms) { 223 _cur_strong_code_root_purge_time_ms = ms; 224 } 225 226 void record_evac_fail_recalc_used_time(double ms) { 227 _cur_evac_fail_recalc_used = ms; 228 } 229 230 void record_evac_fail_remove_self_forwards(double ms) { 231 _cur_evac_fail_remove_self_forwards = ms; 232 } 233 234 void record_string_dedup_fixup_time(double ms) { 235 _cur_string_dedup_fixup_time_ms = ms; 236 } 237 238 void record_ref_proc_time(double ms) { 239 _cur_ref_proc_time_ms = ms; 240 } 241 242 void record_ref_enq_time(double ms) { 243 _cur_ref_enq_time_ms = ms; 244 } 245 246 void record_root_region_scan_wait_time(double time_ms) { 247 _root_region_scan_wait_time_ms = time_ms; 248 } 249 250 void record_total_free_cset_time_ms(double time_ms) { 251 _recorded_total_free_cset_time_ms = time_ms; 252 } 253 254 void record_serial_free_cset_time_ms(double time_ms) { 255 _recorded_serial_free_cset_time_ms = time_ms; 256 } 257 258 void record_fast_reclaim_humongous_stats(double time_ms, size_t total, size_t candidates) { 259 _cur_fast_reclaim_humongous_register_time_ms = time_ms; 260 _cur_fast_reclaim_humongous_total = total; 261 _cur_fast_reclaim_humongous_candidates = candidates; 262 } 263 264 void record_fast_reclaim_humongous_time_ms(double value, size_t reclaimed) { 265 _cur_fast_reclaim_humongous_time_ms = value; 266 _cur_fast_reclaim_humongous_reclaimed = reclaimed; 267 } 268 269 void record_young_cset_choice_time_ms(double time_ms) { 270 _recorded_young_cset_choice_time_ms = time_ms; 271 } 272 273 void record_non_young_cset_choice_time_ms(double time_ms) { 274 _recorded_non_young_cset_choice_time_ms = time_ms; 275 } 276 277 void record_redirty_logged_cards_time_ms(double time_ms) { 278 _recorded_redirty_logged_cards_time_ms = time_ms; 279 } 280 281 void record_preserve_cm_referents_time_ms(double time_ms) { 282 _recorded_preserve_cm_referents_time_ms = time_ms; 283 } 284 285 void record_merge_pss_time_ms(double time_ms) { 286 _recorded_merge_pss_time_ms = time_ms; 287 } 288 289 void record_start_new_cset_time_ms(double time_ms) { 290 _recorded_start_new_cset_time_ms = time_ms; 291 } 292 293 void record_cur_collection_start_sec(double time_ms) { 294 _cur_collection_start_sec = time_ms; 295 } 296 297 void record_verify_before_time_ms(double time_ms) { 298 _cur_verify_before_time_ms = time_ms; 299 } 300 301 void record_verify_after_time_ms(double time_ms) { 302 _cur_verify_after_time_ms = time_ms; 303 } 304 305 void inc_external_accounted_time_ms(double time_ms) { 306 _external_accounted_time_ms += time_ms; 307 } 308 309 void record_clear_claimed_marks_time_ms(double recorded_clear_claimed_marks_time_ms) { 310 _recorded_clear_claimed_marks_time_ms = recorded_clear_claimed_marks_time_ms; 311 } 312 313 double cur_collection_start_sec() { 314 return _cur_collection_start_sec; 315 } 316 317 double cur_collection_par_time_ms() { 318 return _cur_collection_par_time_ms; 319 } 320 321 double cur_clear_ct_time_ms() { 322 return _cur_clear_ct_time_ms; 323 } 324 325 double cur_expand_heap_time_ms() { 326 return _cur_expand_heap_time_ms; 327 } 328 329 double root_region_scan_wait_time_ms() { 330 return _root_region_scan_wait_time_ms; 331 } 332 333 double young_cset_choice_time_ms() { 334 return _recorded_young_cset_choice_time_ms; 335 } 336 337 double total_free_cset_time_ms() { 338 return _recorded_total_free_cset_time_ms; 339 } 340 341 double non_young_cset_choice_time_ms() { 342 return _recorded_non_young_cset_choice_time_ms; 343 } 344 345 double fast_reclaim_humongous_time_ms() { 346 return _cur_fast_reclaim_humongous_time_ms; 347 } 348 }; 349 350 class G1GCParPhaseTimesTracker : public StackObj { 351 double _start_time; 352 G1GCPhaseTimes::GCParPhases _phase; 353 G1GCPhaseTimes* _phase_times; 354 uint _worker_id; 355 public: 356 G1GCParPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1GCPhaseTimes::GCParPhases phase, uint worker_id); 357 ~G1GCParPhaseTimesTracker(); 358 }; 359 360 #endif // SHARE_VM_GC_G1_G1GCPHASETIMES_HPP --- EOF ---