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 "memory/allocation.hpp" 29 30 class LineBuffer; 31 32 template <class T> class WorkerDataArray; 33 34 class G1GCPhaseTimes : public CHeapObj<mtGC> { 35 friend class G1GCParPhasePrinter; 36 37 uint _active_gc_threads; 38 uint _max_gc_threads; 39 jlong _gc_start_counter; 40 double _gc_pause_time_ms; 41 42 public: 43 enum GCParPhases { 44 GCWorkerStart, 45 ExtRootScan, 46 ThreadRoots, 47 StringTableRoots, 48 UniverseRoots, 49 JNIRoots, 50 ObjectSynchronizerRoots, 51 FlatProfilerRoots, 52 ManagementRoots, 53 SystemDictionaryRoots, 54 CLDGRoots, 55 JVMTIRoots, 56 CMRefRoots, 103 104 double _external_accounted_time_ms; 105 106 double _recorded_young_cset_choice_time_ms; 107 double _recorded_non_young_cset_choice_time_ms; 108 109 double _recorded_redirty_logged_cards_time_ms; 110 111 double _recorded_young_free_cset_time_ms; 112 double _recorded_non_young_free_cset_time_ms; 113 114 double _cur_fast_reclaim_humongous_time_ms; 115 double _cur_fast_reclaim_humongous_register_time_ms; 116 size_t _cur_fast_reclaim_humongous_total; 117 size_t _cur_fast_reclaim_humongous_candidates; 118 size_t _cur_fast_reclaim_humongous_reclaimed; 119 120 double _cur_verify_before_time_ms; 121 double _cur_verify_after_time_ms; 122 123 // Helper methods for detailed logging 124 void print_stats(const char*, const char* str, double value); 125 126 void note_gc_end(); 127 128 public: 129 G1GCPhaseTimes(uint max_gc_threads); 130 void note_gc_start(uint active_gc_threads); 131 void print(); 132 133 // record the time a phase took in seconds 134 void record_time_secs(GCParPhases phase, uint worker_i, double secs); 135 136 // add a number of seconds to a phase 137 void add_time_secs(GCParPhases phase, uint worker_i, double secs); 138 139 void record_thread_work_item(GCParPhases phase, uint worker_i, size_t count); 140 141 // return the average time for a phase in milliseconds 142 double average_time_ms(GCParPhases phase); 143 144 size_t sum_thread_work_items(GCParPhases phase); 145 146 private: 147 double get_time_ms(GCParPhases phase, uint worker_i); 148 double sum_time_ms(GCParPhases phase); 149 double min_time_ms(GCParPhases phase); 150 double max_time_ms(GCParPhases phase); 151 size_t get_thread_work_item(GCParPhases phase, uint worker_i); 152 double average_thread_work_items(GCParPhases phase); 153 size_t min_thread_work_items(GCParPhases phase); 154 size_t max_thread_work_items(GCParPhases phase); 155 156 public: 157 158 void record_clear_ct_time(double ms) { 159 _cur_clear_ct_time_ms = ms; 160 } 161 162 void record_expand_heap_time(double ms) { 163 _cur_expand_heap_time_ms = ms; 164 } 165 166 void record_par_time(double ms) { 167 _cur_collection_par_time_ms = ms; 168 } 169 170 void record_code_root_fixup_time(double ms) { 171 _cur_collection_code_root_fixup_time_ms = ms; 172 } 173 174 void record_strong_code_root_purge_time(double ms) { 175 _cur_strong_code_root_purge_time_ms = ms; 232 233 void record_redirty_logged_cards_time_ms(double time_ms) { 234 _recorded_redirty_logged_cards_time_ms = time_ms; 235 } 236 237 void record_cur_collection_start_sec(double time_ms) { 238 _cur_collection_start_sec = time_ms; 239 } 240 241 void record_verify_before_time_ms(double time_ms) { 242 _cur_verify_before_time_ms = time_ms; 243 } 244 245 void record_verify_after_time_ms(double time_ms) { 246 _cur_verify_after_time_ms = time_ms; 247 } 248 249 void inc_external_accounted_time_ms(double time_ms) { 250 _external_accounted_time_ms += time_ms; 251 } 252 253 double accounted_time_ms(); 254 255 double cur_collection_start_sec() { 256 return _cur_collection_start_sec; 257 } 258 259 double cur_collection_par_time_ms() { 260 return _cur_collection_par_time_ms; 261 } 262 263 double cur_clear_ct_time_ms() { 264 return _cur_clear_ct_time_ms; 265 } 266 267 double cur_expand_heap_time_ms() { 268 return _cur_expand_heap_time_ms; 269 } 270 271 double root_region_scan_wait_time_ms() { 272 return _root_region_scan_wait_time_ms; 273 } | 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 "memory/allocation.hpp" 29 30 class LineBuffer; 31 32 template <class T> class WorkerDataArray; 33 34 class G1GCPhaseTimes : public CHeapObj<mtGC> { 35 uint _active_gc_threads; 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, 101 102 double _external_accounted_time_ms; 103 104 double _recorded_young_cset_choice_time_ms; 105 double _recorded_non_young_cset_choice_time_ms; 106 107 double _recorded_redirty_logged_cards_time_ms; 108 109 double _recorded_young_free_cset_time_ms; 110 double _recorded_non_young_free_cset_time_ms; 111 112 double _cur_fast_reclaim_humongous_time_ms; 113 double _cur_fast_reclaim_humongous_register_time_ms; 114 size_t _cur_fast_reclaim_humongous_total; 115 size_t _cur_fast_reclaim_humongous_candidates; 116 size_t _cur_fast_reclaim_humongous_reclaimed; 117 118 double _cur_verify_before_time_ms; 119 double _cur_verify_after_time_ms; 120 121 void note_gc_end(); 122 123 template <class T> 124 void details(T* phase, const char* indent); 125 void log_phase(WorkerDataArray<double>* phase, uint indent, outputStream* out, bool print_sum); 126 void debug_phase(WorkerDataArray<double>* phase); 127 void trace_phase(WorkerDataArray<double>* phase, bool print_sum = true); 128 129 public: 130 G1GCPhaseTimes(uint max_gc_threads); 131 void note_gc_start(uint active_gc_threads); 132 void print(); 133 134 // record the time a phase took in seconds 135 void record_time_secs(GCParPhases phase, uint worker_i, double secs); 136 137 // add a number of seconds to a phase 138 void add_time_secs(GCParPhases phase, uint worker_i, double secs); 139 140 void record_thread_work_item(GCParPhases phase, uint worker_i, size_t count); 141 142 // return the average time for a phase in milliseconds 143 double average_time_ms(GCParPhases phase); 144 145 size_t sum_thread_work_items(GCParPhases phase); 146 147 public: 148 149 void record_clear_ct_time(double ms) { 150 _cur_clear_ct_time_ms = ms; 151 } 152 153 void record_expand_heap_time(double ms) { 154 _cur_expand_heap_time_ms = ms; 155 } 156 157 void record_par_time(double ms) { 158 _cur_collection_par_time_ms = ms; 159 } 160 161 void record_code_root_fixup_time(double ms) { 162 _cur_collection_code_root_fixup_time_ms = ms; 163 } 164 165 void record_strong_code_root_purge_time(double ms) { 166 _cur_strong_code_root_purge_time_ms = ms; 223 224 void record_redirty_logged_cards_time_ms(double time_ms) { 225 _recorded_redirty_logged_cards_time_ms = time_ms; 226 } 227 228 void record_cur_collection_start_sec(double time_ms) { 229 _cur_collection_start_sec = time_ms; 230 } 231 232 void record_verify_before_time_ms(double time_ms) { 233 _cur_verify_before_time_ms = time_ms; 234 } 235 236 void record_verify_after_time_ms(double time_ms) { 237 _cur_verify_after_time_ms = time_ms; 238 } 239 240 void inc_external_accounted_time_ms(double time_ms) { 241 _external_accounted_time_ms += time_ms; 242 } 243 244 double cur_collection_start_sec() { 245 return _cur_collection_start_sec; 246 } 247 248 double cur_collection_par_time_ms() { 249 return _cur_collection_par_time_ms; 250 } 251 252 double cur_clear_ct_time_ms() { 253 return _cur_clear_ct_time_ms; 254 } 255 256 double cur_expand_heap_time_ms() { 257 return _cur_expand_heap_time_ms; 258 } 259 260 double root_region_scan_wait_time_ms() { 261 return _root_region_scan_wait_time_ms; 262 } |