linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Calculating latency using high resolution timer
       [not found] <AANLkTikuWI08hHb2BdzicdEYKO4SdQlCL17gDQgqwrKz@mail.gmail.com>
@ 2010-06-09 16:21 ` Sarin, Suseelan
  2010-06-09 18:30   ` Thomas Gleixner
       [not found]   ` <4C0FD3E4.9090304@gmail.com>
  0 siblings, 2 replies; 4+ messages in thread
From: Sarin, Suseelan @ 2010-06-09 16:21 UTC (permalink / raw)
  To: linux-rt-users

Hi All,

My real-time program has a thread which needs to run at every 2ms. I
want to calculate the latency of this thread and I am using
clock_gettime for this. I am bit confused here that whether I can do
this. My doubt is, if the system is loaded to the extend that an RT
task can have considerable latency, can I trust the time read from the
high resolution timer of the system?

Also, with these measurements, I am seeing a ~5msec latency. Is there
a way I can exactly point out the reason for this latency?

Thanks in advance.

Regards,
Sarin

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

* Re: Calculating latency using high resolution timer
  2010-06-09 16:21 ` Calculating latency using high resolution timer Sarin, Suseelan
@ 2010-06-09 18:30   ` Thomas Gleixner
  2010-06-10  6:13     ` Sarin, Suseelan
       [not found]   ` <4C0FD3E4.9090304@gmail.com>
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2010-06-09 18:30 UTC (permalink / raw)
  To: Sarin, Suseelan; +Cc: linux-rt-users

On Wed, 9 Jun 2010, Sarin, Suseelan wrote:

> Hi All,
> 
> My real-time program has a thread which needs to run at every 2ms. I
> want to calculate the latency of this thread and I am using
> clock_gettime for this. I am bit confused here that whether I can do
> this. My doubt is, if the system is loaded to the extend that an RT
> task can have considerable latency, can I trust the time read from the
> high resolution timer of the system?

Yes, it's accurate. cyclictest relies on that as well.

> Also, with these measurements, I am seeing a ~5msec latency. Is there
> a way I can exactly point out the reason for this latency?

Tracing. See cyclictest.c for how that's done.

Thanks,

	tglx

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

* Re: Calculating latency using high resolution timer
       [not found]   ` <4C0FD3E4.9090304@gmail.com>
@ 2010-06-10  6:11     ` Sarin, Suseelan
  0 siblings, 0 replies; 4+ messages in thread
From: Sarin, Suseelan @ 2010-06-10  6:11 UTC (permalink / raw)
  To: Reagan Thomas; +Cc: linux-rt-users

>
> Not a lot of information about your test (kernel version, kernel config, -rt patch, your code, etc) in your mail, but I would expect a 2 millisecond deadline to be easy to meet.  At 5 milliseconds, I'd say you aren't using RT scheduling at all.
>

Thank you for the response and for the code. I haven't seen your code
in detail, but will do that soon. I am running 2.6.29 with board
specific patches and patched with 2.6.29-rt3. ARMv5 running at about
700 bogo-mips. When the system is completely in use, the CPU usage
goes and stays at 99%+ for most of the time.

> The output below is from a pretty crude/simple chunk of test code that was run on kernel 2.6.26.8-rt16 (yes, it's old, but it's a box thats up and reachable by me right now). Times are in microseconds.  The code sleeps for 100 microseconds, then checks how long it actually slept, outputting some stats once a second.
>
> crappy test code is at:
> http://www.rato.us/ltest.c
> Compile with "gcc ltest.c -lrt -oltest".
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: Calculating latency using high resolution timer
  2010-06-09 18:30   ` Thomas Gleixner
@ 2010-06-10  6:13     ` Sarin, Suseelan
  0 siblings, 0 replies; 4+ messages in thread
From: Sarin, Suseelan @ 2010-06-10  6:13 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: linux-rt-users

>> this. My doubt is, if the system is loaded to the extend that an RT
>> task can have considerable latency, can I trust the time read from the
>> high resolution timer of the system?
>
> Yes, it's accurate. cyclictest relies on that as well.
>
>> Also, with these measurements, I am seeing a ~5msec latency. Is there
>> a way I can exactly point out the reason for this latency?
>
> Tracing. See cyclictest.c for how that's done.

Thank you. I will check the cyclic test code and get back.

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

end of thread, other threads:[~2010-06-10  6:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <AANLkTikuWI08hHb2BdzicdEYKO4SdQlCL17gDQgqwrKz@mail.gmail.com>
2010-06-09 16:21 ` Calculating latency using high resolution timer Sarin, Suseelan
2010-06-09 18:30   ` Thomas Gleixner
2010-06-10  6:13     ` Sarin, Suseelan
     [not found]   ` <4C0FD3E4.9090304@gmail.com>
2010-06-10  6:11     ` Sarin, Suseelan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).