clock_nanosleep versus cyclictest

More
26 Jun 2018 15:14 #112893 by Sylvain
Hello !
I try to benchmark a preempt_RT kernel and I don't get the same result depending on which measurement protocol I use.
If I use this cyclictest :
sudo taskset -c 1 cyclictest -m -p 99
, I've got very nice result (<100µs).
If I use a C snippet calling clock_nanosleep() periodically and computing for each loop the time difference between the former and the current wake up, I end up with huge latency spikes of tens ms !

May I ask you some hints please ?

Cheers

Sylvain

Please Log in or Create an account to join the conversation.

More
26 Jun 2018 20:32 #112910 by andypugh
Are you expecting real-time performance from non-realtime code?

Please Log in or Create an account to join the conversation.

More
27 Jun 2018 08:38 #112919 by Sylvain
Hi Andy,

Thanks for your answer.

To be honest, I assumed that the preempt_rt patch turns the linux kernel into a RT one.
I come from digital signal processor world and dedicated proprietory hard RT kernel, I have no experience in linux RT patched kernels.
Nowadays I have to work in the i386 world and I need to taylor a free RT OS, hence preempt_rt seemed to suit quite well my 100µs of maximum latency requirements, at least, according to what I could read from google.

May I ask you more inputs from your statement related to my misuse and even misunderstanding of the clock_nanosleep functionality ?

Attached my snippet clock_nanosleep based.

With best regards

Sylvain
Attachments:

Please Log in or Create an account to join the conversation.

More
27 Jun 2018 08:56 #112920 by andypugh
preempt-rt might do what you want,I simply don't know.

The way that LinuxCNC uses the realtime layer is to run specific code in "threads" which are called at well-defined intervals.
The functions attached to the threads are definitely called with timing jitter in the 100uS range. In fact quite often in the 10uS range.
But I don't know if this is the only way to use preempt-rt.

I think that you would get more complete answers on either the linuxcnc-dev mailing list (link at the top under "community") or on the dedicated preempt-rt forums. (assuming that there are some)

Please Log in or Create an account to join the conversation.

More
27 Jun 2018 09:06 #112922 by Sylvain
Thanks Andy, I gonna try the dev mailing list and go further in my RT forum google quest ;-)
Have a nice day and thanks for helping

Please Log in or Create an account to join the conversation.

More
27 Jun 2018 10:45 #112925 by rodw
The other area where I understand preempt_rt is used is in the audio world. Audio mixers can't allow latency in their signals so maybe search there as well. (I'm not a musician so don't ask me anything about this...)

Please Log in or Create an account to join the conversation.

Time to create page: 0.135 seconds
Powered by Kunena Forum