< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.cpp

Print this page
rev 58201 : 8240216: Shenandoah: remove ShenandoahTerminationTrace
Reviewed-by: XXX


  27 #include "gc/shared/workerDataArray.inline.hpp"
  28 #include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
  29 #include "gc/shenandoah/shenandoahPhaseTimings.hpp"
  30 #include "gc/shenandoah/shenandoahHeap.hpp"
  31 #include "gc/shenandoah/shenandoahHeuristics.hpp"
  32 #include "gc/shenandoah/shenandoahUtils.hpp"
  33 #include "utilities/ostream.hpp"
  34 
  35 #define GC_PHASE_DECLARE_NAME(type, title) \
  36   title,
  37 
  38 const char* ShenandoahPhaseTimings::_phase_names[] = {
  39   SHENANDOAH_GC_PHASE_DO(GC_PHASE_DECLARE_NAME)
  40 };
  41 
  42 #undef GC_PHASE_DECLARE_NAME
  43 
  44 ShenandoahPhaseTimings::ShenandoahPhaseTimings() : _policy(NULL) {
  45   uint max_workers = MAX2(ConcGCThreads, ParallelGCThreads);
  46   _worker_times = new ShenandoahWorkerTimings(max_workers);
  47   _termination_times = new ShenandoahTerminationTimings(max_workers);
  48   _policy = ShenandoahHeap::heap()->shenandoah_policy();
  49   assert(_policy != NULL, "Can not be NULL");
  50 }
  51 
  52 void ShenandoahPhaseTimings::record_phase_start(Phase phase) {
  53   _timing_data[phase]._start = os::elapsedTime();
  54 }
  55 
  56 void ShenandoahPhaseTimings::record_phase_end(Phase phase) {
  57   assert(_policy != NULL, "Not yet initialized");
  58   double end = os::elapsedTime();
  59   double elapsed = end - _timing_data[phase]._start;
  60   if (!_policy->is_at_shutdown()) {
  61     _timing_data[phase]._secs.add(elapsed);
  62   }
  63   ShenandoahHeap::heap()->heuristics()->record_phase_time(phase, elapsed);
  64 }
  65 
  66 void ShenandoahPhaseTimings::record_phase_time(Phase phase, double time) {
  67   assert(_policy != NULL, "Not yet initialized");


 148 }
 149 
 150 // record the time a phase took in seconds
 151 void ShenandoahWorkerTimings::record_time_secs(ShenandoahPhaseTimings::GCParPhases phase, uint worker_i, double secs) {
 152   _gc_par_phases[phase]->set(worker_i, secs);
 153 }
 154 
 155 double ShenandoahWorkerTimings::average(uint i) const {
 156   return _gc_par_phases[i]->average();
 157 }
 158 
 159 void ShenandoahWorkerTimings::reset(uint i) {
 160   _gc_par_phases[i]->reset();
 161 }
 162 
 163 void ShenandoahWorkerTimings::print() const {
 164   for (uint i = 0; i < ShenandoahPhaseTimings::GCParPhasesSentinel; i++) {
 165     _gc_par_phases[i]->print_summary_on(tty);
 166   }
 167 }
 168 
 169 
 170 ShenandoahTerminationTimings::ShenandoahTerminationTimings(uint max_gc_threads) {
 171   _gc_termination_phase = new WorkerDataArray<double>("Task Termination (ms):", max_gc_threads);
 172 }
 173 
 174 void ShenandoahTerminationTimings::record_time_secs(uint worker_id, double secs) {
 175   if (_gc_termination_phase->get(worker_id) == WorkerDataArray<double>::uninitialized()) {
 176     _gc_termination_phase->set(worker_id, secs);
 177   } else {
 178     // worker may re-enter termination phase
 179     _gc_termination_phase->add(worker_id, secs);
 180   }
 181 }
 182 
 183 void ShenandoahTerminationTimings::print() const {
 184   _gc_termination_phase->print_summary_on(tty);
 185 }
 186 
 187 double ShenandoahTerminationTimings::average() const {
 188   return _gc_termination_phase->average();
 189 }
 190 
 191 void ShenandoahTerminationTimings::reset() {
 192   _gc_termination_phase->reset();
 193 }
 194 


  27 #include "gc/shared/workerDataArray.inline.hpp"
  28 #include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
  29 #include "gc/shenandoah/shenandoahPhaseTimings.hpp"
  30 #include "gc/shenandoah/shenandoahHeap.hpp"
  31 #include "gc/shenandoah/shenandoahHeuristics.hpp"
  32 #include "gc/shenandoah/shenandoahUtils.hpp"
  33 #include "utilities/ostream.hpp"
  34 
  35 #define GC_PHASE_DECLARE_NAME(type, title) \
  36   title,
  37 
  38 const char* ShenandoahPhaseTimings::_phase_names[] = {
  39   SHENANDOAH_GC_PHASE_DO(GC_PHASE_DECLARE_NAME)
  40 };
  41 
  42 #undef GC_PHASE_DECLARE_NAME
  43 
  44 ShenandoahPhaseTimings::ShenandoahPhaseTimings() : _policy(NULL) {
  45   uint max_workers = MAX2(ConcGCThreads, ParallelGCThreads);
  46   _worker_times = new ShenandoahWorkerTimings(max_workers);

  47   _policy = ShenandoahHeap::heap()->shenandoah_policy();
  48   assert(_policy != NULL, "Can not be NULL");
  49 }
  50 
  51 void ShenandoahPhaseTimings::record_phase_start(Phase phase) {
  52   _timing_data[phase]._start = os::elapsedTime();
  53 }
  54 
  55 void ShenandoahPhaseTimings::record_phase_end(Phase phase) {
  56   assert(_policy != NULL, "Not yet initialized");
  57   double end = os::elapsedTime();
  58   double elapsed = end - _timing_data[phase]._start;
  59   if (!_policy->is_at_shutdown()) {
  60     _timing_data[phase]._secs.add(elapsed);
  61   }
  62   ShenandoahHeap::heap()->heuristics()->record_phase_time(phase, elapsed);
  63 }
  64 
  65 void ShenandoahPhaseTimings::record_phase_time(Phase phase, double time) {
  66   assert(_policy != NULL, "Not yet initialized");


 147 }
 148 
 149 // record the time a phase took in seconds
 150 void ShenandoahWorkerTimings::record_time_secs(ShenandoahPhaseTimings::GCParPhases phase, uint worker_i, double secs) {
 151   _gc_par_phases[phase]->set(worker_i, secs);
 152 }
 153 
 154 double ShenandoahWorkerTimings::average(uint i) const {
 155   return _gc_par_phases[i]->average();
 156 }
 157 
 158 void ShenandoahWorkerTimings::reset(uint i) {
 159   _gc_par_phases[i]->reset();
 160 }
 161 
 162 void ShenandoahWorkerTimings::print() const {
 163   for (uint i = 0; i < ShenandoahPhaseTimings::GCParPhasesSentinel; i++) {
 164     _gc_par_phases[i]->print_summary_on(tty);
 165   }
 166 }



























< prev index next >