@@ -253,9 +253,9 @@ void ShenandoahPacer::pace_for_alloc(size_t words) {
253
253
return ;
254
254
}
255
255
256
- jlong const max_delay = ShenandoahPacingMaxDelay * NANOSECS_PER_MILLISEC ;
257
- jlong const start_time = os::elapsed_counter ( );
258
- while (!claimed && ( os::elapsed_counter () - start_time) < max_delay ) {
256
+ jlong const start_time = os::javaTimeNanos () ;
257
+ jlong const deadline = start_time + (ShenandoahPacingMaxDelay * NANOSECS_PER_MILLISEC );
258
+ while (!claimed && os::javaTimeNanos () < deadline ) {
259
259
// We could instead assist GC, but this would suffice for now.
260
260
wait (1 );
261
261
claimed = claim_for_alloc<false >(words);
@@ -267,7 +267,7 @@ void ShenandoahPacer::pace_for_alloc(size_t words) {
267
267
claimed = claim_for_alloc<true >(words);
268
268
assert (claimed, " Should always succeed" );
269
269
}
270
- ShenandoahThreadLocalData::add_paced_time (current, (double )(os::elapsed_counter () - start_time) / NANOSECS_PER_SEC);
270
+ ShenandoahThreadLocalData::add_paced_time (current, (double )(os::javaTimeNanos () - start_time) / NANOSECS_PER_SEC);
271
271
}
272
272
273
273
void ShenandoahPacer::wait (size_t time_ms) {
@@ -276,7 +276,7 @@ void ShenandoahPacer::wait(size_t time_ms) {
276
276
assert (time_ms > 0 , " Should not call this with zero argument, as it would stall until notify" );
277
277
assert (time_ms <= LONG_MAX, " Sanity" );
278
278
MonitorLocker locker (_wait_monitor);
279
- _wait_monitor->wait (( long ) time_ms);
279
+ _wait_monitor->wait (time_ms);
280
280
}
281
281
282
282
void ShenandoahPacer::notify_waiters () {
0 commit comments