TSC-I2: A Lightweight Implementation for Precision-Augmented Timekeeping
Authors: Luo, X., Boote, J.
Publication: Dr. Dobb’s Journal, October 2005 Issue
The quality of timekeeping is critical for many network protocols and measurement tools. Software packages, such as UDT (UDP-based Data Transfer), ThruLay (Throughput and Delay) and OWAMP (Oneway Ping), make control decisions and network statistics by checking the timestamps on the sent / received packets, which are normally labeled according to the system clock. Although when synchronized with NTP (Network Time Protocol), system clock could achieve satisfying accuracy, its precision is still a problem at microsecond level.
For example, most Linux kernels update their system time counters at 10-millisecond interval, and get the time in-between by interpolating TSC (CPU frequency counter) register. As interpolation parameters are obtained at start-up and TSC register subject to frequency wander, the interpolated time’s precision is questionable. TSC-I2 (TSC-Internet2) is devised to address the precision problem mentioned above.
The basic idea is to make TSC rate calibration a continuous process, thus the accuracy of interpolation parameters could be ensured, which in turn results in satisfying clock precision.
TSC-I2 maintains a soft clock of its own, compares this clock to system clock periodically. During each comparison, it synchronizes itself with the system clock, and adjusts the interpolation rate based on the offset and rate errors regarding to system clock. Whenever the accuracy of the soft clock is ensured, TSC-I2 uses this clock to report time to the library user; otherwise, the system clock value is reported.
The advantage of this design is that system clock is enhanced rather than substituted.
Date: October 1, 2005
Document: View PDF