Tue, 19 May 2015 15:49:27 +0200
8061715: gc/g1/TestShrinkAuxiliaryData15.java fails with java.lang.RuntimeException: heap decommit failed - after > before
Summary: added WhiteBox methods to count regions and exact aux data sizes
Reviewed-by: jwilhelm, brutisso
brutisso@3923 | 1 | /* |
tschatzl@6402 | 2 | * Copyright (c) 2013, 2014 Oracle and/or its affiliates. All rights reserved. |
brutisso@3923 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
brutisso@3923 | 4 | * |
brutisso@3923 | 5 | * This code is free software; you can redistribute it and/or modify it |
brutisso@3923 | 6 | * under the terms of the GNU General Public License version 2 only, as |
brutisso@3923 | 7 | * published by the Free Software Foundation. |
brutisso@3923 | 8 | * |
brutisso@3923 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
brutisso@3923 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
brutisso@3923 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
brutisso@3923 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
brutisso@3923 | 13 | * accompanied this code). |
brutisso@3923 | 14 | * |
brutisso@3923 | 15 | * You should have received a copy of the GNU General Public License version |
brutisso@3923 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
brutisso@3923 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
brutisso@3923 | 18 | * |
brutisso@3923 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
brutisso@3923 | 20 | * or visit www.oracle.com if you need additional information or have any |
brutisso@3923 | 21 | * questions. |
brutisso@3923 | 22 | * |
brutisso@3923 | 23 | */ |
brutisso@3923 | 24 | |
brutisso@3923 | 25 | #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1GCPHASETIMESLOG_HPP |
brutisso@3923 | 26 | #define SHARE_VM_GC_IMPLEMENTATION_G1_G1GCPHASETIMESLOG_HPP |
brutisso@3923 | 27 | |
brutisso@3923 | 28 | #include "memory/allocation.hpp" |
brutisso@3923 | 29 | |
brutisso@7658 | 30 | class LineBuffer; |
brutisso@4015 | 31 | |
brutisso@7658 | 32 | template <class T> class WorkerDataArray; |
brutisso@4015 | 33 | |
jmasa@3924 | 34 | class G1GCPhaseTimes : public CHeapObj<mtGC> { |
brutisso@7658 | 35 | friend class G1GCParPhasePrinter; |
brutisso@3923 | 36 | |
brutisso@3923 | 37 | uint _active_gc_threads; |
brutisso@3923 | 38 | uint _max_gc_threads; |
brutisso@3923 | 39 | |
brutisso@7658 | 40 | public: |
brutisso@7658 | 41 | enum GCParPhases { |
brutisso@7658 | 42 | GCWorkerStart, |
brutisso@7658 | 43 | ExtRootScan, |
brutisso@7660 | 44 | ThreadRoots, |
brutisso@7660 | 45 | StringTableRoots, |
brutisso@7660 | 46 | UniverseRoots, |
brutisso@7660 | 47 | JNIRoots, |
brutisso@7660 | 48 | ObjectSynchronizerRoots, |
brutisso@7660 | 49 | FlatProfilerRoots, |
brutisso@7660 | 50 | ManagementRoots, |
brutisso@7660 | 51 | SystemDictionaryRoots, |
brutisso@7660 | 52 | CLDGRoots, |
brutisso@7660 | 53 | JVMTIRoots, |
brutisso@7660 | 54 | CodeCacheRoots, |
brutisso@7660 | 55 | CMRefRoots, |
brutisso@7660 | 56 | WaitForStrongCLD, |
brutisso@7660 | 57 | WeakCLDRoots, |
brutisso@7658 | 58 | SATBFiltering, |
brutisso@7658 | 59 | UpdateRS, |
brutisso@7658 | 60 | ScanRS, |
brutisso@7658 | 61 | CodeRoots, |
brutisso@7658 | 62 | ObjCopy, |
brutisso@7658 | 63 | Termination, |
brutisso@7658 | 64 | Other, |
brutisso@7658 | 65 | GCWorkerTotal, |
brutisso@7658 | 66 | GCWorkerEnd, |
brutisso@7658 | 67 | StringDedupQueueFixup, |
brutisso@7658 | 68 | StringDedupTableFixup, |
brutisso@7658 | 69 | RedirtyCards, |
brutisso@7658 | 70 | GCParPhasesSentinel |
brutisso@7658 | 71 | }; |
brutisso@7658 | 72 | |
brutisso@7658 | 73 | private: |
brutisso@7658 | 74 | // Markers for grouping the phases in the GCPhases enum above |
brutisso@7658 | 75 | static const int GCMainParPhasesLast = GCWorkerEnd; |
brutisso@7658 | 76 | static const int StringDedupPhasesFirst = StringDedupQueueFixup; |
brutisso@7658 | 77 | static const int StringDedupPhasesLast = StringDedupTableFixup; |
brutisso@7658 | 78 | |
brutisso@7658 | 79 | WorkerDataArray<double>* _gc_par_phases[GCParPhasesSentinel]; |
brutisso@7658 | 80 | WorkerDataArray<size_t>* _update_rs_processed_buffers; |
brutisso@7658 | 81 | WorkerDataArray<size_t>* _termination_attempts; |
brutisso@7658 | 82 | WorkerDataArray<size_t>* _redirtied_cards; |
brutisso@3923 | 83 | |
brutisso@3923 | 84 | double _cur_collection_par_time_ms; |
brutisso@3923 | 85 | double _cur_collection_code_root_fixup_time_ms; |
tschatzl@6402 | 86 | double _cur_strong_code_root_purge_time_ms; |
brutisso@3923 | 87 | |
tschatzl@6406 | 88 | double _cur_evac_fail_recalc_used; |
tschatzl@6406 | 89 | double _cur_evac_fail_restore_remsets; |
tschatzl@6406 | 90 | double _cur_evac_fail_remove_self_forwards; |
tschatzl@6406 | 91 | |
brutisso@7658 | 92 | double _cur_string_dedup_fixup_time_ms; |
pliden@6413 | 93 | |
brutisso@3923 | 94 | double _cur_clear_ct_time_ms; |
brutisso@3923 | 95 | double _cur_ref_proc_time_ms; |
brutisso@3923 | 96 | double _cur_ref_enq_time_ms; |
brutisso@3923 | 97 | |
brutisso@3923 | 98 | double _cur_collection_start_sec; |
brutisso@3923 | 99 | double _root_region_scan_wait_time_ms; |
brutisso@3923 | 100 | |
brutisso@3923 | 101 | double _recorded_young_cset_choice_time_ms; |
brutisso@3923 | 102 | double _recorded_non_young_cset_choice_time_ms; |
brutisso@3923 | 103 | |
tschatzl@6405 | 104 | double _recorded_redirty_logged_cards_time_ms; |
tschatzl@6405 | 105 | |
brutisso@3923 | 106 | double _recorded_young_free_cset_time_ms; |
brutisso@3923 | 107 | double _recorded_non_young_free_cset_time_ms; |
brutisso@3923 | 108 | |
tschatzl@7010 | 109 | double _cur_fast_reclaim_humongous_time_ms; |
tschatzl@7828 | 110 | double _cur_fast_reclaim_humongous_register_time_ms; |
tschatzl@7010 | 111 | size_t _cur_fast_reclaim_humongous_total; |
tschatzl@7010 | 112 | size_t _cur_fast_reclaim_humongous_candidates; |
tschatzl@7010 | 113 | size_t _cur_fast_reclaim_humongous_reclaimed; |
tschatzl@7010 | 114 | |
brutisso@4015 | 115 | double _cur_verify_before_time_ms; |
brutisso@4015 | 116 | double _cur_verify_after_time_ms; |
brutisso@4015 | 117 | |
brutisso@4015 | 118 | // Helper methods for detailed logging |
brutisso@4015 | 119 | void print_stats(int level, const char* str, double value); |
tschatzl@7010 | 120 | void print_stats(int level, const char* str, size_t value); |
vkempik@6552 | 121 | void print_stats(int level, const char* str, double value, uint workers); |
brutisso@3923 | 122 | |
brutisso@3923 | 123 | public: |
brutisso@3923 | 124 | G1GCPhaseTimes(uint max_gc_threads); |
brutisso@7658 | 125 | void note_gc_start(uint active_gc_threads, bool mark_in_progress); |
brutisso@4015 | 126 | void note_gc_end(); |
brutisso@4015 | 127 | void print(double pause_time_sec); |
brutisso@3923 | 128 | |
brutisso@7658 | 129 | // record the time a phase took in seconds |
brutisso@7658 | 130 | void record_time_secs(GCParPhases phase, uint worker_i, double secs); |
brutisso@3923 | 131 | |
brutisso@7658 | 132 | // add a number of seconds to a phase |
brutisso@7658 | 133 | void add_time_secs(GCParPhases phase, uint worker_i, double secs); |
brutisso@3923 | 134 | |
brutisso@7658 | 135 | void record_thread_work_item(GCParPhases phase, uint worker_i, size_t count); |
brutisso@3923 | 136 | |
brutisso@7658 | 137 | // return the average time for a phase in milliseconds |
brutisso@7658 | 138 | double average_time_ms(GCParPhases phase); |
brutisso@3923 | 139 | |
brutisso@7658 | 140 | size_t sum_thread_work_items(GCParPhases phase); |
brutisso@3923 | 141 | |
brutisso@7658 | 142 | private: |
brutisso@7658 | 143 | double get_time_ms(GCParPhases phase, uint worker_i); |
brutisso@7658 | 144 | double sum_time_ms(GCParPhases phase); |
brutisso@7658 | 145 | double min_time_ms(GCParPhases phase); |
brutisso@7658 | 146 | double max_time_ms(GCParPhases phase); |
brutisso@7658 | 147 | size_t get_thread_work_item(GCParPhases phase, uint worker_i); |
brutisso@7658 | 148 | double average_thread_work_items(GCParPhases phase); |
brutisso@7658 | 149 | size_t min_thread_work_items(GCParPhases phase); |
brutisso@7658 | 150 | size_t max_thread_work_items(GCParPhases phase); |
brutisso@3923 | 151 | |
brutisso@7658 | 152 | public: |
brutisso@3923 | 153 | |
brutisso@3923 | 154 | void record_clear_ct_time(double ms) { |
brutisso@3923 | 155 | _cur_clear_ct_time_ms = ms; |
brutisso@3923 | 156 | } |
brutisso@3923 | 157 | |
brutisso@3923 | 158 | void record_par_time(double ms) { |
brutisso@3923 | 159 | _cur_collection_par_time_ms = ms; |
brutisso@3923 | 160 | } |
brutisso@3923 | 161 | |
brutisso@3923 | 162 | void record_code_root_fixup_time(double ms) { |
brutisso@3923 | 163 | _cur_collection_code_root_fixup_time_ms = ms; |
brutisso@3923 | 164 | } |
brutisso@3923 | 165 | |
tschatzl@6402 | 166 | void record_strong_code_root_purge_time(double ms) { |
tschatzl@6402 | 167 | _cur_strong_code_root_purge_time_ms = ms; |
tschatzl@6402 | 168 | } |
tschatzl@6402 | 169 | |
tschatzl@6406 | 170 | void record_evac_fail_recalc_used_time(double ms) { |
tschatzl@6406 | 171 | _cur_evac_fail_recalc_used = ms; |
tschatzl@6406 | 172 | } |
tschatzl@6406 | 173 | |
tschatzl@6406 | 174 | void record_evac_fail_restore_remsets(double ms) { |
tschatzl@6406 | 175 | _cur_evac_fail_restore_remsets = ms; |
tschatzl@6406 | 176 | } |
tschatzl@6406 | 177 | |
tschatzl@6406 | 178 | void record_evac_fail_remove_self_forwards(double ms) { |
tschatzl@6406 | 179 | _cur_evac_fail_remove_self_forwards = ms; |
tschatzl@6406 | 180 | } |
tschatzl@6406 | 181 | |
pliden@6413 | 182 | void record_string_dedup_fixup_time(double ms) { |
pliden@6413 | 183 | _cur_string_dedup_fixup_time_ms = ms; |
pliden@6413 | 184 | } |
pliden@6413 | 185 | |
brutisso@3923 | 186 | void record_ref_proc_time(double ms) { |
brutisso@3923 | 187 | _cur_ref_proc_time_ms = ms; |
brutisso@3923 | 188 | } |
brutisso@3923 | 189 | |
brutisso@3923 | 190 | void record_ref_enq_time(double ms) { |
brutisso@3923 | 191 | _cur_ref_enq_time_ms = ms; |
brutisso@3923 | 192 | } |
brutisso@3923 | 193 | |
brutisso@3923 | 194 | void record_root_region_scan_wait_time(double time_ms) { |
brutisso@3923 | 195 | _root_region_scan_wait_time_ms = time_ms; |
brutisso@3923 | 196 | } |
brutisso@3923 | 197 | |
brutisso@3923 | 198 | void record_young_free_cset_time_ms(double time_ms) { |
brutisso@3923 | 199 | _recorded_young_free_cset_time_ms = time_ms; |
brutisso@3923 | 200 | } |
brutisso@3923 | 201 | |
brutisso@3923 | 202 | void record_non_young_free_cset_time_ms(double time_ms) { |
brutisso@3923 | 203 | _recorded_non_young_free_cset_time_ms = time_ms; |
brutisso@3923 | 204 | } |
brutisso@4015 | 205 | |
tschatzl@7828 | 206 | void record_fast_reclaim_humongous_stats(double time_ms, size_t total, size_t candidates) { |
tschatzl@7828 | 207 | _cur_fast_reclaim_humongous_register_time_ms = time_ms; |
tschatzl@7010 | 208 | _cur_fast_reclaim_humongous_total = total; |
tschatzl@7010 | 209 | _cur_fast_reclaim_humongous_candidates = candidates; |
tschatzl@7010 | 210 | } |
tschatzl@7010 | 211 | |
tschatzl@7010 | 212 | void record_fast_reclaim_humongous_time_ms(double value, size_t reclaimed) { |
tschatzl@7010 | 213 | _cur_fast_reclaim_humongous_time_ms = value; |
tschatzl@7010 | 214 | _cur_fast_reclaim_humongous_reclaimed = reclaimed; |
tschatzl@7010 | 215 | } |
tschatzl@7010 | 216 | |
brutisso@4015 | 217 | void record_young_cset_choice_time_ms(double time_ms) { |
brutisso@4015 | 218 | _recorded_young_cset_choice_time_ms = time_ms; |
brutisso@4015 | 219 | } |
brutisso@4015 | 220 | |
brutisso@4015 | 221 | void record_non_young_cset_choice_time_ms(double time_ms) { |
brutisso@4015 | 222 | _recorded_non_young_cset_choice_time_ms = time_ms; |
brutisso@4015 | 223 | } |
brutisso@4015 | 224 | |
tschatzl@6405 | 225 | void record_redirty_logged_cards_time_ms(double time_ms) { |
tschatzl@6405 | 226 | _recorded_redirty_logged_cards_time_ms = time_ms; |
tschatzl@6405 | 227 | } |
tschatzl@6405 | 228 | |
brutisso@4015 | 229 | void record_cur_collection_start_sec(double time_ms) { |
brutisso@4015 | 230 | _cur_collection_start_sec = time_ms; |
brutisso@4015 | 231 | } |
brutisso@4015 | 232 | |
brutisso@4015 | 233 | void record_verify_before_time_ms(double time_ms) { |
brutisso@4015 | 234 | _cur_verify_before_time_ms = time_ms; |
brutisso@4015 | 235 | } |
brutisso@4015 | 236 | |
brutisso@4015 | 237 | void record_verify_after_time_ms(double time_ms) { |
brutisso@4015 | 238 | _cur_verify_after_time_ms = time_ms; |
brutisso@4015 | 239 | } |
brutisso@4015 | 240 | |
brutisso@4015 | 241 | double accounted_time_ms(); |
brutisso@4015 | 242 | |
brutisso@4015 | 243 | double cur_collection_start_sec() { |
brutisso@4015 | 244 | return _cur_collection_start_sec; |
brutisso@4015 | 245 | } |
brutisso@4015 | 246 | |
brutisso@4015 | 247 | double cur_collection_par_time_ms() { |
brutisso@4015 | 248 | return _cur_collection_par_time_ms; |
brutisso@4015 | 249 | } |
brutisso@4015 | 250 | |
brutisso@4015 | 251 | double cur_clear_ct_time_ms() { |
brutisso@4015 | 252 | return _cur_clear_ct_time_ms; |
brutisso@4015 | 253 | } |
brutisso@4015 | 254 | |
brutisso@4015 | 255 | double root_region_scan_wait_time_ms() { |
brutisso@4015 | 256 | return _root_region_scan_wait_time_ms; |
brutisso@4015 | 257 | } |
brutisso@4015 | 258 | |
brutisso@4015 | 259 | double young_cset_choice_time_ms() { |
brutisso@4015 | 260 | return _recorded_young_cset_choice_time_ms; |
brutisso@4015 | 261 | } |
brutisso@4015 | 262 | |
brutisso@4015 | 263 | double young_free_cset_time_ms() { |
brutisso@4015 | 264 | return _recorded_young_free_cset_time_ms; |
brutisso@4015 | 265 | } |
brutisso@4015 | 266 | |
brutisso@4015 | 267 | double non_young_cset_choice_time_ms() { |
brutisso@4015 | 268 | return _recorded_non_young_cset_choice_time_ms; |
brutisso@4015 | 269 | } |
brutisso@4015 | 270 | |
brutisso@4015 | 271 | double non_young_free_cset_time_ms() { |
brutisso@4015 | 272 | return _recorded_non_young_free_cset_time_ms; |
brutisso@4015 | 273 | } |
brutisso@4015 | 274 | |
tschatzl@7010 | 275 | double fast_reclaim_humongous_time_ms() { |
tschatzl@7010 | 276 | return _cur_fast_reclaim_humongous_time_ms; |
tschatzl@7010 | 277 | } |
brutisso@7658 | 278 | }; |
tschatzl@7010 | 279 | |
brutisso@7658 | 280 | class G1GCParPhaseTimesTracker : public StackObj { |
brutisso@7658 | 281 | double _start_time; |
brutisso@7658 | 282 | G1GCPhaseTimes::GCParPhases _phase; |
brutisso@7658 | 283 | G1GCPhaseTimes* _phase_times; |
brutisso@7658 | 284 | uint _worker_id; |
brutisso@7658 | 285 | public: |
brutisso@7658 | 286 | G1GCParPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1GCPhaseTimes::GCParPhases phase, uint worker_id); |
brutisso@7658 | 287 | ~G1GCParPhaseTimesTracker(); |
brutisso@3923 | 288 | }; |
brutisso@3923 | 289 | |
brutisso@3923 | 290 | #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1GCPHASETIMESLOG_HPP |