Abstract:
Timestamps are used to record receiving and transmitting time for each packet and are of great importance in measuring network performance metrics such as delay, bandwidth and jitters. Limited by the uncertainty of packet buffering delay and interrupts, software-based timestamps can only achieve milliseconds-precision. Although timestamps based on global positioning system (GPS) can achieve nanoseconds-precision, it is too expensive and inconvenient for large scale use. In this paper, we analyze the root cause of inaccuracy for software-based timestamps. Based on these analyses, we propose a timestamp system which involves programmable network interface card (NIC) and prediction-based clock synchronization (PCS) algorithm. When a packet arrives at the NIC, a hardware timestamp is generated in the NIC which precisely records the accurate time. As the timestamp is inserted by hardware, all the uncertainty introduced by software are eliminated. PCS algorithm is used to synchronize the clock of one NIC with other NICs. With one NIC set to be master, other slave NIC will adjust their clock according to PCS algorithm to synchronize with the master's clock. We implement the prototype system in our gigabit network interface card. The system achieves the same accuracy as GPS does. Test results show that the deviation between two cards is no bigger than 100ns.