< prev index next >

src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp

Print this page




 108   return (size_t)-1;
 109 }
 110 
 111 template <>
 112 double WorkerDataArray<double>::uninitialized() {
 113   return -1.0;
 114 }
 115 
 116 template <class T>
 117 void WorkerDataArray<T>::reset() {
 118   for (uint i = 0; i < _length; i++) {
 119     _data[i] = WorkerDataArray<T>::uninitialized();
 120   }
 121   if (_sub_count != NULL) {
 122     _sub_count->reset();
 123   }
 124 }
 125 
 126 template <class T>
 127 void WorkerDataArray<T>::verify() {




 128   for (uint i = 0; i < _length; i++) {
 129     assert(_data[i] != WorkerDataArray<T>::uninitialized(),
 130         err_msg("Invalid data for worker %u in '%s'", i, _title));
 131   }
 132   if (_sub_count != NULL) {
 133     _sub_count->verify();
 134   }
 135 }
 136 
 137 #endif
 138 
 139 template class WorkerDataArray<double>;
 140 template class WorkerDataArray<size_t>;
 141 
 142 G1GCPhaseTimes::G1GCPhaseTimes(uint max_gc_threads) :
 143   _max_gc_threads(max_gc_threads)
 144 {
 145   assert(max_gc_threads > 0, "Must have some GC threads");
 146 
 147   _gc_phases[GCWorkerStart] = new WorkerDataArray<double>(max_gc_threads, "GC Worker Start (ms)", false, G1Log::LevelFiner, 2);


 295     }
 296     print_stats(2, "Humongous Reclaim", _cur_fast_reclaim_humongous_time_ms);
 297     if (G1Log::finest()) {
 298       print_stats(3, "Humongous Reclaimed", _cur_fast_reclaim_humongous_reclaimed);
 299     }
 300   }
 301   print_stats(2, "Free CSet",
 302     (_recorded_young_free_cset_time_ms +
 303     _recorded_non_young_free_cset_time_ms));
 304   if (G1Log::finest()) {
 305     print_stats(3, "Young Free CSet", _recorded_young_free_cset_time_ms);
 306     print_stats(3, "Non-Young Free CSet", _recorded_non_young_free_cset_time_ms);
 307   }
 308   if (_cur_verify_after_time_ms > 0.0) {
 309     print_stats(2, "Verify After", _cur_verify_after_time_ms);
 310   }
 311 }
 312 
 313 G1GCPhaseTimesTracker::G1GCPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1GCPhaseTimes::GCPhases phase, uint worker_id) :
 314     _phase_times(phase_times), _phase(phase), _worker_id(worker_id) {

 315   _start_time = os::elapsedTime();

 316 }
 317 
 318 G1GCPhaseTimesTracker::~G1GCPhaseTimesTracker() {

 319   _phase_times->record_time_secs(_phase, _worker_id, os::elapsedTime() - _start_time);

 320 }
 321 
 322 void G1GCPhasePrinter::print_single_length(G1GCPhaseTimes::GCPhases phase_id, WorkerDataArray<double>* phase) {
 323   // No need for min, max, average and sum for only one worker
 324   LineBuffer buf(phase->_indent_level);
 325   buf.append_and_print_cr("[%s:  %.1lf]", phase->_title, _phase_times->get_time_ms(phase_id, 0));
 326 
 327   if (phase->_sub_count != NULL) {
 328     LineBuffer buf2(phase->_sub_count->_indent_level);
 329     buf2.append_and_print_cr("[%s:  "SIZE_FORMAT"]", phase->_sub_count->_title, _phase_times->sub_count_sum(phase_id));
 330   }
 331 }
 332 
 333 void G1GCPhasePrinter::print_time_values(LineBuffer& buf, G1GCPhaseTimes::GCPhases phase_id, WorkerDataArray<double>* phase) {
 334   for (uint i = 0; i < phase->_length; ++i) {
 335     buf.append("  %.1lf", _phase_times->get_time_ms(phase_id, i));
 336   }
 337   buf.print_cr();
 338 }
 339 




 108   return (size_t)-1;
 109 }
 110 
 111 template <>
 112 double WorkerDataArray<double>::uninitialized() {
 113   return -1.0;
 114 }
 115 
 116 template <class T>
 117 void WorkerDataArray<T>::reset() {
 118   for (uint i = 0; i < _length; i++) {
 119     _data[i] = WorkerDataArray<T>::uninitialized();
 120   }
 121   if (_sub_count != NULL) {
 122     _sub_count->reset();
 123   }
 124 }
 125 
 126 template <class T>
 127 void WorkerDataArray<T>::verify() {
 128   if (!_enabled) {
 129     return;
 130   }
 131 
 132   for (uint i = 0; i < _length; i++) {
 133     assert(_data[i] != WorkerDataArray<T>::uninitialized(),
 134         err_msg("Invalid data for worker %u in '%s'", i, _title));
 135   }
 136   if (_sub_count != NULL) {
 137     _sub_count->verify();
 138   }
 139 }
 140 
 141 #endif
 142 
 143 template class WorkerDataArray<double>;
 144 template class WorkerDataArray<size_t>;
 145 
 146 G1GCPhaseTimes::G1GCPhaseTimes(uint max_gc_threads) :
 147   _max_gc_threads(max_gc_threads)
 148 {
 149   assert(max_gc_threads > 0, "Must have some GC threads");
 150 
 151   _gc_phases[GCWorkerStart] = new WorkerDataArray<double>(max_gc_threads, "GC Worker Start (ms)", false, G1Log::LevelFiner, 2);


 299     }
 300     print_stats(2, "Humongous Reclaim", _cur_fast_reclaim_humongous_time_ms);
 301     if (G1Log::finest()) {
 302       print_stats(3, "Humongous Reclaimed", _cur_fast_reclaim_humongous_reclaimed);
 303     }
 304   }
 305   print_stats(2, "Free CSet",
 306     (_recorded_young_free_cset_time_ms +
 307     _recorded_non_young_free_cset_time_ms));
 308   if (G1Log::finest()) {
 309     print_stats(3, "Young Free CSet", _recorded_young_free_cset_time_ms);
 310     print_stats(3, "Non-Young Free CSet", _recorded_non_young_free_cset_time_ms);
 311   }
 312   if (_cur_verify_after_time_ms > 0.0) {
 313     print_stats(2, "Verify After", _cur_verify_after_time_ms);
 314   }
 315 }
 316 
 317 G1GCPhaseTimesTracker::G1GCPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1GCPhaseTimes::GCPhases phase, uint worker_id) :
 318     _phase_times(phase_times), _phase(phase), _worker_id(worker_id) {
 319   if (_phase_times != NULL) {
 320     _start_time = os::elapsedTime();
 321   }
 322 }
 323 
 324 G1GCPhaseTimesTracker::~G1GCPhaseTimesTracker() {
 325   if (_phase_times != NULL) {
 326     _phase_times->record_time_secs(_phase, _worker_id, os::elapsedTime() - _start_time);
 327   }
 328 }
 329 
 330 void G1GCPhasePrinter::print_single_length(G1GCPhaseTimes::GCPhases phase_id, WorkerDataArray<double>* phase) {
 331   // No need for min, max, average and sum for only one worker
 332   LineBuffer buf(phase->_indent_level);
 333   buf.append_and_print_cr("[%s:  %.1lf]", phase->_title, _phase_times->get_time_ms(phase_id, 0));
 334 
 335   if (phase->_sub_count != NULL) {
 336     LineBuffer buf2(phase->_sub_count->_indent_level);
 337     buf2.append_and_print_cr("[%s:  "SIZE_FORMAT"]", phase->_sub_count->_title, _phase_times->sub_count_sum(phase_id));
 338   }
 339 }
 340 
 341 void G1GCPhasePrinter::print_time_values(LineBuffer& buf, G1GCPhaseTimes::GCPhases phase_id, WorkerDataArray<double>* phase) {
 342   for (uint i = 0; i < phase->_length; ++i) {
 343     buf.append("  %.1lf", _phase_times->get_time_ms(phase_id, i));
 344   }
 345   buf.print_cr();
 346 }
 347 


< prev index next >