All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Antoine Nourry <nourry@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] rt_timer_read() value
Date: Tue, 08 Jul 2008 21:52:24 +0200	[thread overview]
Message-ID: <4873C578.4030107@domain.hid> (raw)
In-Reply-To: <4873C2EE.5050400@domain.hid>

Antoine Nourry wrote:
>> rt_timer_read value should never be decreasing, except maybe from time
>> to time when an overflow takes place. A decreasing clock would really be
>> something unatural to work with. Overflow may take place more often if you
>> cast the return value of rt_timer_read to 32 bits: it is a 64 bits
>> value, and I would not expect it to overflow before years of uptime.
>> So, there is probably something wrong with your program. Have you
>> included native/timer.h ? Do you store the result of rt_timer_read in a
>> 64 bits variable ?
> yes and no, the worst is that i was focused on the trivial periodic 
> example where time is casted to long type. I think i had tried with long 
> double, which type do you typically use for this value ?

RTIME, documented as the return type of rt_timer_read.

>> The only function which you can call without breaking real-time are
>> those documented as such in Xenomai native skin (or posix skin, for that
>> matter) documentation. Everything else needs careful inspection.
>> Everything that uses Linux system calls, such as for instance, functions
>> accessing non real-time drivers such as a keyboard driver, will break
>> real-time. The only functions that have a chance not to break real-time
>> are those which do not use system calls (and do not call functions which
>> use system calls), the function "sin" comes to my mind as an example of
>> such a function.
> Another thing, as timer is running in parallel to every tasks, would it 
> be possible to measure time elapsed from the moment picture appears
> to the keypress event ? If i can't be sure to benefit from very low 
> latency during all this period, can i rely on this ns-scale timer to 
> inform me on how much time elapsed in each functions, in order to deduct 
> it from my raw reaction time ? I have another time reaction program but 
> its time pace is too high for high accuracy...
> How would you resolve this problem and is real-time really the answer ?

Since the two actions you want to time are non real-time, you should
probably better use linux services, such as gettimeofday.

-- 


					    Gilles.


      reply	other threads:[~2008-07-08 19:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-08 19:41 [Xenomai-help] rt_timer_read() value Antoine Nourry
2008-07-08 19:52 ` Gilles Chanteperdrix [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=4873C578.4030107@domain.hid \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=nourry@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.