From: Philippe Gerum <rpm@xenomai.org>
To: alberto.ozalla@cgglobal.com,
"gilles.chanteperdrix@xenomai.org"
<gilles.chanteperdrix@xenomai.org>
Cc: "xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: [Xenomai] rt_task_sleep_until() miss release point?
Date: Fri, 07 Nov 2014 10:42:00 +0100 [thread overview]
Message-ID: <545C93E8.3060206@xenomai.org> (raw)
In-Reply-To: <545BA5D0.7010907@cgglobal.com>
On 11/06/2014 05:46 PM, ZIV-Alberto Ozalla Cantabrana wrote:
> Hi,
>
> These are the simplest examples:
> There are no MSW for Test_Task.
> The goal is to increment counter_ms each millisecond.
>
> Given that:
> 1000000 nanoseconds = 24000 tsc.
> 1 tsc = 41 ns
>
> RT_TASK Test_Task_descriptor;
> volatile unsigned long long counter_ms;
>
> void Test_Task(void *arg)
> {
> rt_task_set_mode(0, 0, NULL);
>
> RTIME t1, t2;
> counter_ms = 0;
>
> while(1) {
> t1 = rt_timer_tsc();
> t2 = t1 + 24000; // 24000 tsc = 1 ms
> rt_task_sleep_until(rt_timer_tsc2ns(t2));
rt_task_sleep_until() refers to the real-time clock for applying delays,
i.e. adjusted with the wallclock offset. You can't pass it a value based
on the monotonic clock. This is why using timevals based on
rt_timer_read() works, but using rt_timer_tsc() doesn't.
--
Philippe.
prev parent reply other threads:[~2014-11-07 9:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-06 15:24 [Xenomai] rt_task_sleep_until() miss release point? ZIV-Alberto Ozalla Cantabrana
2014-11-06 15:37 ` Gilles Chanteperdrix
2014-11-06 15:52 ` ZIV-Alberto Ozalla Cantabrana
2014-11-06 15:55 ` Gilles Chanteperdrix
2014-11-06 16:46 ` ZIV-Alberto Ozalla Cantabrana
2014-11-06 20:22 ` Philippe Gerum
2014-11-07 9:25 ` ZIV-Alberto Ozalla Cantabrana
2014-11-07 9:37 ` Gilles Chanteperdrix
2014-11-07 9:42 ` Philippe Gerum [this message]
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=545C93E8.3060206@xenomai.org \
--to=rpm@xenomai.org \
--cc=alberto.ozalla@cgglobal.com \
--cc=gilles.chanteperdrix@xenomai.org \
--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.