The SleepCalibrator thread is used to calibrate the deviation of the sleep time for compensation purposes. We already know the semantics of sleep points to the minimum sleep time. The actual time calculated from
- System.currentTimeMillis()
- Thread.sleep(sleepTime)
- System.currentTimeMillis()
is always higher than sleepTime. The difference varies largely between systems and could dramatically skew the driver cycles. It is however expected to be in the 10s of milliseconds or less than 10 milliseconds range.
The SleepCalibrator must be run by each agent during the rampup time. Assuming the rampup is adequately long, it should capture a pretty good average deviation which will include the effects of several garbage collections and use this difference to compensate the sleep time.
@author Akara Sucharitakul