Tue, 17 Oct 2017 12:58:25 +0800
merge
aoqi@0 | 1 | /* |
tschatzl@7893 | 2 | * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 4 | * |
aoqi@0 | 5 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 6 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 7 | * published by the Free Software Foundation. |
aoqi@0 | 8 | * |
aoqi@0 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 13 | * accompanied this code). |
aoqi@0 | 14 | * |
aoqi@0 | 15 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 18 | * |
aoqi@0 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 20 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 21 | * questions. |
aoqi@0 | 22 | * |
aoqi@0 | 23 | */ |
aoqi@0 | 24 | |
aoqi@0 | 25 | #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1GCPHASETIMESLOG_HPP |
aoqi@0 | 26 | #define SHARE_VM_GC_IMPLEMENTATION_G1_G1GCPHASETIMESLOG_HPP |
aoqi@0 | 27 | |
aoqi@0 | 28 | #include "memory/allocation.hpp" |
aoqi@0 | 29 | |
brutisso@7658 | 30 | class LineBuffer; |
aoqi@0 | 31 | |
brutisso@7658 | 32 | template <class T> class WorkerDataArray; |
aoqi@0 | 33 | |
aoqi@0 | 34 | class G1GCPhaseTimes : public CHeapObj<mtGC> { |
brutisso@7658 | 35 | friend class G1GCParPhasePrinter; |
aoqi@0 | 36 | |
aoqi@0 | 37 | uint _active_gc_threads; |
aoqi@0 | 38 | uint _max_gc_threads; |
aoqi@0 | 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; |
aoqi@0 | 83 | |
aoqi@0 | 84 | double _cur_collection_par_time_ms; |
aoqi@0 | 85 | double _cur_collection_code_root_fixup_time_ms; |
aoqi@0 | 86 | double _cur_strong_code_root_purge_time_ms; |
aoqi@0 | 87 | |
aoqi@0 | 88 | double _cur_evac_fail_recalc_used; |
aoqi@0 | 89 | double _cur_evac_fail_restore_remsets; |
aoqi@0 | 90 | double _cur_evac_fail_remove_self_forwards; |
aoqi@0 | 91 | |
brutisso@7658 | 92 | double _cur_string_dedup_fixup_time_ms; |
aoqi@0 | 93 | |
aoqi@0 | 94 | double _cur_clear_ct_time_ms; |
aoqi@0 | 95 | double _cur_ref_proc_time_ms; |
aoqi@0 | 96 | double _cur_ref_enq_time_ms; |
aoqi@0 | 97 | |
aoqi@0 | 98 | double _cur_collection_start_sec; |
aoqi@0 | 99 | double _root_region_scan_wait_time_ms; |
aoqi@0 | 100 | |
aoqi@0 | 101 | double _recorded_young_cset_choice_time_ms; |
aoqi@0 | 102 | double _recorded_non_young_cset_choice_time_ms; |
aoqi@0 | 103 | |
aoqi@0 | 104 | double _recorded_redirty_logged_cards_time_ms; |
aoqi@0 | 105 | |
aoqi@0 | 106 | double _recorded_young_free_cset_time_ms; |
aoqi@0 | 107 | double _recorded_non_young_free_cset_time_ms; |
aoqi@0 | 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 | |
aoqi@0 | 115 | double _cur_verify_before_time_ms; |
aoqi@0 | 116 | double _cur_verify_after_time_ms; |
aoqi@0 | 117 | |
aoqi@0 | 118 | // Helper methods for detailed logging |
aoqi@0 | 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); |
aoqi@0 | 121 | void print_stats(int level, const char* str, double value, uint workers); |
aoqi@0 | 122 | |
aoqi@0 | 123 | public: |
aoqi@0 | 124 | G1GCPhaseTimes(uint max_gc_threads); |
brutisso@7658 | 125 | void note_gc_start(uint active_gc_threads, bool mark_in_progress); |
aoqi@0 | 126 | void note_gc_end(); |
aoqi@0 | 127 | void print(double pause_time_sec); |
aoqi@0 | 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); |
aoqi@0 | 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); |
aoqi@0 | 134 | |
brutisso@7658 | 135 | void record_thread_work_item(GCParPhases phase, uint worker_i, size_t count); |
aoqi@0 | 136 | |
brutisso@7658 | 137 | // return the average time for a phase in milliseconds |
brutisso@7658 | 138 | double average_time_ms(GCParPhases phase); |
aoqi@0 | 139 | |
brutisso@7658 | 140 | size_t sum_thread_work_items(GCParPhases phase); |
aoqi@0 | 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); |
aoqi@0 | 151 | |
brutisso@7658 | 152 | public: |
aoqi@0 | 153 | |
aoqi@0 | 154 | void record_clear_ct_time(double ms) { |
aoqi@0 | 155 | _cur_clear_ct_time_ms = ms; |
aoqi@0 | 156 | } |
aoqi@0 | 157 | |
aoqi@0 | 158 | void record_par_time(double ms) { |
aoqi@0 | 159 | _cur_collection_par_time_ms = ms; |
aoqi@0 | 160 | } |
aoqi@0 | 161 | |
aoqi@0 | 162 | void record_code_root_fixup_time(double ms) { |
aoqi@0 | 163 | _cur_collection_code_root_fixup_time_ms = ms; |
aoqi@0 | 164 | } |
aoqi@0 | 165 | |
aoqi@0 | 166 | void record_strong_code_root_purge_time(double ms) { |
aoqi@0 | 167 | _cur_strong_code_root_purge_time_ms = ms; |
aoqi@0 | 168 | } |
aoqi@0 | 169 | |
aoqi@0 | 170 | void record_evac_fail_recalc_used_time(double ms) { |
aoqi@0 | 171 | _cur_evac_fail_recalc_used = ms; |
aoqi@0 | 172 | } |
aoqi@0 | 173 | |
aoqi@0 | 174 | void record_evac_fail_restore_remsets(double ms) { |
aoqi@0 | 175 | _cur_evac_fail_restore_remsets = ms; |
aoqi@0 | 176 | } |
aoqi@0 | 177 | |
aoqi@0 | 178 | void record_evac_fail_remove_self_forwards(double ms) { |
aoqi@0 | 179 | _cur_evac_fail_remove_self_forwards = ms; |
aoqi@0 | 180 | } |
aoqi@0 | 181 | |
aoqi@0 | 182 | void record_string_dedup_fixup_time(double ms) { |
aoqi@0 | 183 | _cur_string_dedup_fixup_time_ms = ms; |
aoqi@0 | 184 | } |
aoqi@0 | 185 | |
aoqi@0 | 186 | void record_ref_proc_time(double ms) { |
aoqi@0 | 187 | _cur_ref_proc_time_ms = ms; |
aoqi@0 | 188 | } |
aoqi@0 | 189 | |
aoqi@0 | 190 | void record_ref_enq_time(double ms) { |
aoqi@0 | 191 | _cur_ref_enq_time_ms = ms; |
aoqi@0 | 192 | } |
aoqi@0 | 193 | |
aoqi@0 | 194 | void record_root_region_scan_wait_time(double time_ms) { |
aoqi@0 | 195 | _root_region_scan_wait_time_ms = time_ms; |
aoqi@0 | 196 | } |
aoqi@0 | 197 | |
aoqi@0 | 198 | void record_young_free_cset_time_ms(double time_ms) { |
aoqi@0 | 199 | _recorded_young_free_cset_time_ms = time_ms; |
aoqi@0 | 200 | } |
aoqi@0 | 201 | |
aoqi@0 | 202 | void record_non_young_free_cset_time_ms(double time_ms) { |
aoqi@0 | 203 | _recorded_non_young_free_cset_time_ms = time_ms; |
aoqi@0 | 204 | } |
aoqi@0 | 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 | |
aoqi@0 | 217 | void record_young_cset_choice_time_ms(double time_ms) { |
aoqi@0 | 218 | _recorded_young_cset_choice_time_ms = time_ms; |
aoqi@0 | 219 | } |
aoqi@0 | 220 | |
aoqi@0 | 221 | void record_non_young_cset_choice_time_ms(double time_ms) { |
aoqi@0 | 222 | _recorded_non_young_cset_choice_time_ms = time_ms; |
aoqi@0 | 223 | } |
aoqi@0 | 224 | |
aoqi@0 | 225 | void record_redirty_logged_cards_time_ms(double time_ms) { |
aoqi@0 | 226 | _recorded_redirty_logged_cards_time_ms = time_ms; |
aoqi@0 | 227 | } |
aoqi@0 | 228 | |
aoqi@0 | 229 | void record_cur_collection_start_sec(double time_ms) { |
aoqi@0 | 230 | _cur_collection_start_sec = time_ms; |
aoqi@0 | 231 | } |
aoqi@0 | 232 | |
aoqi@0 | 233 | void record_verify_before_time_ms(double time_ms) { |
aoqi@0 | 234 | _cur_verify_before_time_ms = time_ms; |
aoqi@0 | 235 | } |
aoqi@0 | 236 | |
aoqi@0 | 237 | void record_verify_after_time_ms(double time_ms) { |
aoqi@0 | 238 | _cur_verify_after_time_ms = time_ms; |
aoqi@0 | 239 | } |
aoqi@0 | 240 | |
aoqi@0 | 241 | double accounted_time_ms(); |
aoqi@0 | 242 | |
aoqi@0 | 243 | double cur_collection_start_sec() { |
aoqi@0 | 244 | return _cur_collection_start_sec; |
aoqi@0 | 245 | } |
aoqi@0 | 246 | |
aoqi@0 | 247 | double cur_collection_par_time_ms() { |
aoqi@0 | 248 | return _cur_collection_par_time_ms; |
aoqi@0 | 249 | } |
aoqi@0 | 250 | |
aoqi@0 | 251 | double cur_clear_ct_time_ms() { |
aoqi@0 | 252 | return _cur_clear_ct_time_ms; |
aoqi@0 | 253 | } |
aoqi@0 | 254 | |
aoqi@0 | 255 | double root_region_scan_wait_time_ms() { |
aoqi@0 | 256 | return _root_region_scan_wait_time_ms; |
aoqi@0 | 257 | } |
aoqi@0 | 258 | |
aoqi@0 | 259 | double young_cset_choice_time_ms() { |
aoqi@0 | 260 | return _recorded_young_cset_choice_time_ms; |
aoqi@0 | 261 | } |
aoqi@0 | 262 | |
aoqi@0 | 263 | double young_free_cset_time_ms() { |
aoqi@0 | 264 | return _recorded_young_free_cset_time_ms; |
aoqi@0 | 265 | } |
aoqi@0 | 266 | |
aoqi@0 | 267 | double non_young_cset_choice_time_ms() { |
aoqi@0 | 268 | return _recorded_non_young_cset_choice_time_ms; |
aoqi@0 | 269 | } |
aoqi@0 | 270 | |
aoqi@0 | 271 | double non_young_free_cset_time_ms() { |
aoqi@0 | 272 | return _recorded_non_young_free_cset_time_ms; |
aoqi@0 | 273 | } |
aoqi@0 | 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(); |
aoqi@0 | 288 | }; |
aoqi@0 | 289 | |
aoqi@0 | 290 | #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1GCPHASETIMESLOG_HPP |