176 }
177 double value = _gc_par_phases[phase]->get(worker);
178 if (value != WorkerDataArray<double>::uninitialized()) {
179 return value;
180 }
181 return 0.0;
182 }
183
184 void G1GCPhaseTimes::note_gc_end() {
185 _gc_pause_time_ms = TimeHelper::counter_to_millis(os::elapsed_counter() - _gc_start_counter);
186
187 double uninitialized = WorkerDataArray<double>::uninitialized();
188
189 for (uint i = 0; i < _max_gc_threads; i++) {
190 double worker_start = _gc_par_phases[GCWorkerStart]->get(i);
191 if (worker_start != uninitialized) {
192 assert(_gc_par_phases[GCWorkerEnd]->get(i) != uninitialized, "Worker started but not ended.");
193 double total_worker_time = _gc_par_phases[GCWorkerEnd]->get(i) - _gc_par_phases[GCWorkerStart]->get(i);
194 record_time_secs(GCWorkerTotal, i , total_worker_time);
195
196 double worker_known_time =
197 worker_time(ExtRootScan, i)
198 + worker_time(SATBFiltering, i)
199 + worker_time(ScanHCC, i)
200 + worker_time(UpdateRS, i)
201 + worker_time(ScanRS, i)
202 + worker_time(CodeRoots, i)
203 + worker_time(ObjCopy, i)
204 + worker_time(Termination, i);
205
206 record_time_secs(Other, i, total_worker_time - worker_known_time);
207 } else {
208 // Make sure all slots are uninitialized since this thread did not seem to have been started
209 ASSERT_PHASE_UNINITIALIZED(GCWorkerEnd);
210 ASSERT_PHASE_UNINITIALIZED(ExtRootScan);
211 ASSERT_PHASE_UNINITIALIZED(SATBFiltering);
212 ASSERT_PHASE_UNINITIALIZED(ScanHCC);
213 ASSERT_PHASE_UNINITIALIZED(UpdateRS);
214 ASSERT_PHASE_UNINITIALIZED(ScanRS);
215 ASSERT_PHASE_UNINITIALIZED(CodeRoots);
216 ASSERT_PHASE_UNINITIALIZED(ObjCopy);
217 ASSERT_PHASE_UNINITIALIZED(Termination);
218 }
219 }
220 }
221
222 #undef ASSERT_PHASE_UNINITIALIZED
223
224 // record the time a phase took in seconds
225 void G1GCPhaseTimes::record_time_secs(GCParPhases phase, uint worker_i, double secs) {
226 _gc_par_phases[phase]->set(worker_i, secs);
227 }
228
229 // add a number of seconds to a phase
230 void G1GCPhaseTimes::add_time_secs(GCParPhases phase, uint worker_i, double secs) {
231 _gc_par_phases[phase]->add(worker_i, secs);
|
176 }
177 double value = _gc_par_phases[phase]->get(worker);
178 if (value != WorkerDataArray<double>::uninitialized()) {
179 return value;
180 }
181 return 0.0;
182 }
183
184 void G1GCPhaseTimes::note_gc_end() {
185 _gc_pause_time_ms = TimeHelper::counter_to_millis(os::elapsed_counter() - _gc_start_counter);
186
187 double uninitialized = WorkerDataArray<double>::uninitialized();
188
189 for (uint i = 0; i < _max_gc_threads; i++) {
190 double worker_start = _gc_par_phases[GCWorkerStart]->get(i);
191 if (worker_start != uninitialized) {
192 assert(_gc_par_phases[GCWorkerEnd]->get(i) != uninitialized, "Worker started but not ended.");
193 double total_worker_time = _gc_par_phases[GCWorkerEnd]->get(i) - _gc_par_phases[GCWorkerStart]->get(i);
194 record_time_secs(GCWorkerTotal, i , total_worker_time);
195
196 double worker_known_time = worker_time(ExtRootScan, i) +
197 worker_time(ScanHCC, i) +
198 worker_time(UpdateRS, i) +
199 worker_time(ScanRS, i) +
200 worker_time(CodeRoots, i) +
201 worker_time(ObjCopy, i) +
202 worker_time(Termination, i);
203
204 record_time_secs(Other, i, total_worker_time - worker_known_time);
205 } else {
206 // Make sure all slots are uninitialized since this thread did not seem to have been started
207 ASSERT_PHASE_UNINITIALIZED(GCWorkerEnd);
208 ASSERT_PHASE_UNINITIALIZED(ExtRootScan);
209 ASSERT_PHASE_UNINITIALIZED(ScanHCC);
210 ASSERT_PHASE_UNINITIALIZED(UpdateRS);
211 ASSERT_PHASE_UNINITIALIZED(ScanRS);
212 ASSERT_PHASE_UNINITIALIZED(CodeRoots);
213 ASSERT_PHASE_UNINITIALIZED(ObjCopy);
214 ASSERT_PHASE_UNINITIALIZED(Termination);
215 }
216 }
217 }
218
219 #undef ASSERT_PHASE_UNINITIALIZED
220
221 // record the time a phase took in seconds
222 void G1GCPhaseTimes::record_time_secs(GCParPhases phase, uint worker_i, double secs) {
223 _gc_par_phases[phase]->set(worker_i, secs);
224 }
225
226 // add a number of seconds to a phase
227 void G1GCPhaseTimes::add_time_secs(GCParPhases phase, uint worker_i, double secs) {
228 _gc_par_phases[phase]->add(worker_i, secs);
|