Re: [Linuxptp-users] clock_gettime performance using ptp hw clock
PTP IEEE 1588 stack for Linux
Brought to you by:
rcochran
From: Keller, J. E <jac...@in...> - 2013-07-25 21:06:31
|
Hi Ledda, On Thu, 2013-07-25 at 11:36 +0000, Ledda William EXT wrote: > Hi all, > > I’m interested about the performance to read the time from a PTP > hardware clock. I have an Intel i350 chipset with igb driver and HW > TIMESTAMP support. I have two different ptp devices > (/dev/ptp0 /dev/ptp1). I have tried to measure how much time requires > to read the PTP time from this devices. Basically, the “benchmark” > code could be summarized as follow > > > > … > > clockId = pch_open(“/dev/ptp1”) > > > > clock_gettime(CLOCK_MONOTONIC, &start); //current time > > clock_gettime(clockID, &ptp); //PTP time > > clock_gettime(CLOCK_MONOTONIC, &end); //last time > > > > delta = time_diff(start, end) > > ….. > > > > Surprisingly I have found a quite high result: the mean value to read > the PTP clock is about 5 us. To read the time CLOCK_REALTIME or > CLOCK_MONOTONIC clocks, I obtain a mean value of about 600 ns!! > As Richard stated, this is to be expected. The clock is sitting on the network device, and is behind a PCIe link. There is really no good way to get this clock value transferred by reading directly. Once you have synchronized the clock using PTP4l, it would be best practice to use phc2sys to tune the system clock from the ptp device. > > > Can somebody had experience about this? Is there some other way to > read the PTP time with sub-microseconds accuracy? > Once you have used phc2sys, you can get the difference of the system clock to sub microsecond accuracy, and then perform a read of the system time will have the low latency you require as well as the accuracy that you require also. If you want to get the time out to hardware somehow, the i210 has a pin header exposed which you can configure to enable a clock-out from the network hardware device, and then wire this up to some other hardware. This would be the lowest latency you could get, but requires specialized hardware (i210 + some way to translate the clock signal into what other system/application that needs it) The simplest solution would be to create a PPS signal output and then wire that back into the machine somehow. Your best bet would be to synchronize the system time via a phc2sys process, which will get the system time within acceptable bounds and then you no longer need to directly read the network hardware clock outside of phc2sys. Regards, Jacob Keller > > > Thanks! > > > > > > iterlogo > William LEDDA > External Contractor > CODAC Section > > ITER Organization, Building 72/281, CHD, Control System Division > Route de Vinon sur Verdon – 13115 St Paul Lez Durance – France > Phone: +33 4 42 17 85 94 > Get the latest ITER news on http://www.iter.org/newsline/latest |