All of lore.kernel.org
 help / color / mirror / Atom feed
* Difference between Xenomai timer and Linux clock
@ 2022-05-27 13:39 Prasanna Kannan
  2022-05-30  0:55 ` Chen, Hongzhan
  0 siblings, 1 reply; 5+ messages in thread
From: Prasanna Kannan @ 2022-05-27 13:39 UTC (permalink / raw)
  To: xenomai

Hello Everybody,

I am comparing the Xenomai Timer(rt_timer_read()) and clock_gettime() with
CLOCK_REALTIME and found that the two drift at roughly 100 us/s
Here is the snippet from my code:

init():
clock_gettime(CLOCK_REALTIME, &ts_start);
rtime_start = rt_timer_read();

runtime():
clk_xenotime = (rt_timer_read() - rtime_start) * 1e-9;
clock_gettime(CLOCK_REALTIME, &ts);
clk_rttime = (ts.tv_sec - ts_start.tv_sec) + (ts.tv_nsec -
ts_start.tv_nsec) * 1e-9;
delta = clk_rttime - clk_xenotime

The observation is that the delta is around 100us/s
...
ClockGetTime:2.588435s, rt_timer_read:2.588167s, delta:0.000268s
ClockGetTime:3.588533s, rt_timer_read:3.588161s, delta:0.000372s
ClockGetTime:4.588671s, rt_timer_read:4.588196s, delta:0.000475s
...

The Linux clock is not corrected via NTP/PTP, thus I am wondering why they
are drifting in this way.

Some Information about my setup:
Xenomai/cobalt v3.1
Linux rtdonau 4.19.115-ipipe #54 SMP PREEMPT Wed Oct 13 12:16:56 CEST 2021
x86_64 GNU/Linux
Kernel parameters: intel_idle.max_cstate=0 vga=0x317 ip=dhcp root=/dev/nfs
nfsroot=10.0.0.1:/opt/xyz/xeno_rt,tcp,nfsvers=3 BOOT_IMAGE=xeno10.2 
I-pipe release #12 detected
Cobalt core 3.1 detected
Compiler: gcc version 7.5.0 (GCC) 
Build args: --prefix=/opt/xenomai-3.1 --enable-smp --enable-pshared
--enable-dlopen-libs

The hardware used is an Intel SBC based on Core i7-4700EQ CPU @ 2.40GHz

Thank you in Advance.

Best Regards
Prasanna



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-05-30  9:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-27 13:39 Difference between Xenomai timer and Linux clock Prasanna Kannan
2022-05-30  0:55 ` Chen, Hongzhan
2022-05-30  7:33   ` AW: " Prasanna Kannan
2022-05-30  8:44     ` Chen, Hongzhan
2022-05-30  9:54       ` AW: " Prasanna Kannan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.