< prev index next >

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

Print this page

 80 }
 81 
 82 ShenandoahPhaseTimings::Phase ShenandoahPhaseTimings::worker_par_phase(Phase phase, ParPhase par_phase) {
 83   assert(is_worker_phase(phase), "Phase should accept worker phase times: %s", phase_name(phase));
 84   Phase p = Phase(phase + 1 + par_phase);
 85   assert(p >= 0 && p < _num_phases, "Out of bound for: %s", phase_name(phase));
 86   return p;
 87 }
 88 
 89 ShenandoahWorkerData* ShenandoahPhaseTimings::worker_data(Phase phase, ParPhase par_phase) {
 90   Phase p = worker_par_phase(phase, par_phase);
 91   ShenandoahWorkerData* wd = _worker_data[p];
 92   assert(wd != NULL, "Counter initialized: %s", phase_name(p));
 93   return wd;
 94 }
 95 
 96 bool ShenandoahPhaseTimings::is_worker_phase(Phase phase) {
 97   assert(phase >= 0 && phase < _num_phases, "Out of bounds");
 98   switch (phase) {
 99     case init_evac:

100     case finish_mark:
101     case purge_weak_par:
102     case full_gc_mark:
103     case full_gc_update_roots:
104     case full_gc_adjust_roots:
105     case degen_gc_stw_mark:
106     case degen_gc_mark:
107     case degen_gc_update_roots:
108     case full_gc_weakrefs:
109     case full_gc_purge_class_unload:
110     case full_gc_purge_weak_par:
111     case degen_gc_weakrefs:
112     case degen_gc_purge_class_unload:
113     case degen_gc_purge_weak_par:
114     case heap_iteration_roots:

115     case conc_mark_roots:
116     case conc_thread_roots:
117     case conc_weak_roots_work:
118     case conc_weak_refs:
119     case conc_strong_roots:
120       return true;
121     default:
122       return false;
123   }
124 }
125 
126 bool ShenandoahPhaseTimings::is_root_work_phase(Phase phase) {
127   switch (phase) {
128     case finish_mark:
129     case init_evac:
130     case degen_gc_update_roots:
131     case full_gc_mark:
132     case full_gc_update_roots:
133     case full_gc_adjust_roots:
134       return true;

291                     SHENANDOAH_US_TIME_FORMAT ", "
292                     SHENANDOAH_US_TIME_FORMAT ", "
293                     SHENANDOAH_US_TIME_FORMAT ", "
294                     SHENANDOAH_US_TIME_FORMAT ", "
295                     SHENANDOAH_US_TIME_FORMAT ")",
296                     _phase_names[i],
297                     _global_data[i].sum(),
298                     _global_data[i].avg() * 1000000.0,
299                     _global_data[i].num(),
300                     _global_data[i].percentile(0) * 1000000.0,
301                     _global_data[i].percentile(25) * 1000000.0,
302                     _global_data[i].percentile(50) * 1000000.0,
303                     _global_data[i].percentile(75) * 1000000.0,
304                     _global_data[i].maximum() * 1000000.0
305       );
306     }
307   }
308 }
309 
310 ShenandoahWorkerTimingsTracker::ShenandoahWorkerTimingsTracker(ShenandoahPhaseTimings::Phase phase,
311         ShenandoahPhaseTimings::ParPhase par_phase, uint worker_id) :
312         _timings(ShenandoahHeap::heap()->phase_timings()),
313         _phase(phase), _par_phase(par_phase), _worker_id(worker_id) {
314 
315   assert(_timings->worker_data(_phase, _par_phase)->get(_worker_id) == ShenandoahWorkerData::uninitialized(),
316          "Should not be set yet: %s", ShenandoahPhaseTimings::phase_name(_timings->worker_par_phase(_phase, _par_phase)));
317   _start_time = os::elapsedTime();
318 }
319 
320 ShenandoahWorkerTimingsTracker::~ShenandoahWorkerTimingsTracker() {
321   _timings->worker_data(_phase, _par_phase)->set(_worker_id, os::elapsedTime() - _start_time);
322 
323   if (ShenandoahPhaseTimings::is_root_work_phase(_phase)) {
324     ShenandoahPhaseTimings::Phase root_phase = _phase;
325     ShenandoahPhaseTimings::Phase cur_phase = _timings->worker_par_phase(root_phase, _par_phase);
326     _event.commit(GCId::current(), _worker_id, ShenandoahPhaseTimings::phase_name(cur_phase));
327   }
328 }
329 

 80 }
 81 
 82 ShenandoahPhaseTimings::Phase ShenandoahPhaseTimings::worker_par_phase(Phase phase, ParPhase par_phase) {
 83   assert(is_worker_phase(phase), "Phase should accept worker phase times: %s", phase_name(phase));
 84   Phase p = Phase(phase + 1 + par_phase);
 85   assert(p >= 0 && p < _num_phases, "Out of bound for: %s", phase_name(phase));
 86   return p;
 87 }
 88 
 89 ShenandoahWorkerData* ShenandoahPhaseTimings::worker_data(Phase phase, ParPhase par_phase) {
 90   Phase p = worker_par_phase(phase, par_phase);
 91   ShenandoahWorkerData* wd = _worker_data[p];
 92   assert(wd != NULL, "Counter initialized: %s", phase_name(p));
 93   return wd;
 94 }
 95 
 96 bool ShenandoahPhaseTimings::is_worker_phase(Phase phase) {
 97   assert(phase >= 0 && phase < _num_phases, "Out of bounds");
 98   switch (phase) {
 99     case init_evac:
100     case init_scan_rset:
101     case finish_mark:
102     case purge_weak_par:
103     case full_gc_mark:
104     case full_gc_update_roots:
105     case full_gc_adjust_roots:
106     case degen_gc_stw_mark:
107     case degen_gc_mark:
108     case degen_gc_update_roots:
109     case full_gc_weakrefs:
110     case full_gc_purge_class_unload:
111     case full_gc_purge_weak_par:
112     case degen_gc_weakrefs:
113     case degen_gc_purge_class_unload:
114     case degen_gc_purge_weak_par:
115     case heap_iteration_roots:
116     case conc_mark:
117     case conc_mark_roots:
118     case conc_thread_roots:
119     case conc_weak_roots_work:
120     case conc_weak_refs:
121     case conc_strong_roots:
122       return true;
123     default:
124       return false;
125   }
126 }
127 
128 bool ShenandoahPhaseTimings::is_root_work_phase(Phase phase) {
129   switch (phase) {
130     case finish_mark:
131     case init_evac:
132     case degen_gc_update_roots:
133     case full_gc_mark:
134     case full_gc_update_roots:
135     case full_gc_adjust_roots:
136       return true;

293                     SHENANDOAH_US_TIME_FORMAT ", "
294                     SHENANDOAH_US_TIME_FORMAT ", "
295                     SHENANDOAH_US_TIME_FORMAT ", "
296                     SHENANDOAH_US_TIME_FORMAT ", "
297                     SHENANDOAH_US_TIME_FORMAT ")",
298                     _phase_names[i],
299                     _global_data[i].sum(),
300                     _global_data[i].avg() * 1000000.0,
301                     _global_data[i].num(),
302                     _global_data[i].percentile(0) * 1000000.0,
303                     _global_data[i].percentile(25) * 1000000.0,
304                     _global_data[i].percentile(50) * 1000000.0,
305                     _global_data[i].percentile(75) * 1000000.0,
306                     _global_data[i].maximum() * 1000000.0
307       );
308     }
309   }
310 }
311 
312 ShenandoahWorkerTimingsTracker::ShenandoahWorkerTimingsTracker(ShenandoahPhaseTimings::Phase phase,
313         ShenandoahPhaseTimings::ParPhase par_phase, uint worker_id, bool cumulative) :
314         _timings(ShenandoahHeap::heap()->phase_timings()),
315         _phase(phase), _par_phase(par_phase), _worker_id(worker_id) {
316 
317   assert(_timings->worker_data(_phase, _par_phase)->get(_worker_id) == ShenandoahWorkerData::uninitialized() || cumulative,
318          "Should not be set yet: %s", ShenandoahPhaseTimings::phase_name(_timings->worker_par_phase(_phase, _par_phase)));
319   _start_time = os::elapsedTime();
320 }
321 
322 ShenandoahWorkerTimingsTracker::~ShenandoahWorkerTimingsTracker() {
323   _timings->worker_data(_phase, _par_phase)->set_or_add(_worker_id, os::elapsedTime() - _start_time);
324 
325   if (ShenandoahPhaseTimings::is_root_work_phase(_phase)) {
326     ShenandoahPhaseTimings::Phase root_phase = _phase;
327     ShenandoahPhaseTimings::Phase cur_phase = _timings->worker_par_phase(root_phase, _par_phase);
328     _event.commit(GCId::current(), _worker_id, ShenandoahPhaseTimings::phase_name(cur_phase));
329   }
330 }
331 
< prev index next >