Re: [Linuxptp-users] clock_gettime performance using ptp hw clock
PTP IEEE 1588 stack for Linux
Brought to you by:
rcochran
From: Richard C. <ric...@gm...> - 2013-07-25 16:56:58
|
On Thu, Jul 25, 2013 at 11:36:22AM +0000, Ledda William EXT wrote: > 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!! (It is not a surprise to me ;) The i210 is on a PCIe bus, which is a serial bus with a packet based protocol. Individual operations (think PEEK and POKE) have a high latency due to protocol overhead. Five microseconds sounds about right. The Linux kernel offers a highly optimized path to the system clocks. On some architectures it even maps kernel time keeping variables directly to a user space page (vdso) in order to allow low latency time stamps. > Can somebody had experience about this? Is there some other way to > read the PTP time with sub-microseconds accuracy? I wrote a whole paper about this. If you want sub-microsecond accuracy, then you want to use using hardware signals, not software. The best real time systems I have seen (Xenomai or PREEMPT_RT) have a worst case latency of about 10 microseconds. http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=6070158 The best way I know is to synchronize the Linux system time to the PTP hardware clock using the phc2sys program. Applications can then just use CLOCK_REALTIME or CLOCK_MONOTONIC without any changes to the code. HTH, Richard |