All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: at91_enthus <nwromania@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] I-pipe clock source change and MMC issues (AT91)
Date: Sat, 05 Feb 2011 16:39:30 +0100	[thread overview]
Message-ID: <4D4D6F32.4070302@domain.hid> (raw)
In-Reply-To: <AANLkTi=QiGXpMwdY3tEz=Qo0tO8Q5fe1xnPpo+dX3eEP@mail.gmail.com>

at91_enthus wrote:
>>> Rookie mistake. Indeed, I can have everything in userspace using Xenomai.
>> I

Or in kernel-space... with Xenomai RTDM skin.

>>> wrote a simple program that did a periodic job every 100 us and the
>> jitter
>>> was very small (around 20 us without load and around 35 us with SSH-ing
>> and
>>> Xenomai compilation running on board).

Well, as we often say, benchmarking requires making more than that to
load the board, and for a long time.

>>>
>>> Somewhat unrelated to this thread, I found that when I invoked
>>> rt_task_set_periodic(), I got very precise timings (as expected).
>> However,
>>> when I tried to insert small delays using rt_timer_spin(), the errors
>>> (t_meas - t_spin_func_argument) were not large, but noticeable. For
>> example,
>>> I can precisely measure a 50 us periodic task on the scope. With the same
>>> interval in rt_timer_spin(), I get 55-60 us. As far as I understood, all
>>> timing-related functions use the same time base, so what's the reason for
>>> this behavior?
>>

Well, rt_task_set_periodic gets the hardware timer to tick exactly every
50us. So, whatever time it takes between the return of the call to
rt_task_wait_period() to the entry of the next is irrelevant. And
particularily, the jitter will not matter as long as it is smaller than 50u.

On the other hand, doing:

for(;;) {
	/* Do something */
	rt_timer_spin(50000);
}

The period of the loop will be 50us + rt_timer_spin jitter + time to "do
something". And so, will not even be constant.
You are not creating a periodic task. Besides, the system will not
execute anything else in user-space than your real-time task, and in
particular, the Linux will never run. Except of course if "do something"
contains a call to some secondary domain function, in which case, your
real-time task no longer is real-time.

So, that is not the correct way to get a periodic task.

-- 
                                                                Gilles.


  reply	other threads:[~2011-02-05 15:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-02 20:51 [Xenomai-help] I-pipe clock source change and MMC issues (AT91) at91_enthus
2011-02-02 21:39 ` Gilles Chanteperdrix
2011-02-02 22:00   ` at91_enthus
2011-02-02 22:09     ` Gilles Chanteperdrix
2011-02-02 22:22       ` at91_enthus
2011-02-03 10:18         ` Gilles Chanteperdrix
2011-02-03 10:28           ` Gilles Chanteperdrix
2011-02-04  4:24             ` at91_enthus
2011-02-04 22:34               ` Gilles Chanteperdrix
2011-02-05  0:23                 ` at91_enthus
2011-02-05 15:39                   ` Gilles Chanteperdrix [this message]
2011-02-05 17:26                     ` at91_enthus
2011-02-05 17:40                       ` Gilles Chanteperdrix

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D4D6F32.4070302@domain.hid \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=nwromania@domain.hid \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.