All of lore.kernel.org
 help / color / mirror / Atom feed
From: "prakash srinivasan" <asprakash_83@domain.hid>
To: xenomai@xenomai.org
Subject: [Xenomai-help] Timing calculation
Date: 12 Aug 2010 09:39:44 -0000	[thread overview]
Message-ID: <20100812093944.14467.qmail@domain.hid> (raw)

[-- Attachment #1: Type: text/plain, Size: 996 bytes --]

Deal All,

       I am executing a simple for() loop and like to calculate the time period for this loop. I used rt_timer_read(). As per the document, it mentioned that rt_timer_read() returns the current time expressed in clock ticks. I could not able to get an clear idea about it. Suppose if i convert it by using rt_timer_ticks2ns(), I am not getting the proper output. My code is,



RTIME start, end;

...

...

start=rt_timer_read();

for()

{}

end=rt_timer_read();

printf(TOTAL LOOP TIMING=%ld us\n", (long)((rt_timer_ticks2ns(end-start))/1000);



I would like to convert the ticks into nano seconds first and then into micro seconds. The final result is irrelevant. I am not sure, where is the issue. Help me to find the timings details properly.



In the example program trivial-periodic.c, they mentioned 



"NOTE: printf may have unexpected impact on the timing of your program. It is used here in the critical loop only for demonstration purposes."



Why?

 



-Prakash 



  

[-- Attachment #2: Type: text/html, Size: 1533 bytes --]

             reply	other threads:[~2010-08-12  9:39 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-12  9:39 prakash srinivasan [this message]
2010-08-12 10:11 ` [Xenomai-help] Timing calculation Eric Noulard
2010-08-12 11:32   ` prakash srinivasan
2010-08-12 11:56 ` Wolfgang Grandegger
2010-08-12 12:04   ` Eric Noulard
2010-08-12 16:00     ` prakash srinivasan
2010-08-12 15:38   ` asprakash_83
2010-08-12 19:13     ` Wolfgang Grandegger
2010-08-13  4:19       ` prakash srinivasan
2010-08-14 18:33         ` Gilles Chanteperdrix
2010-08-12 15:46   ` prakash srinivasan
  -- strict thread matches above, loose matches on Subject: below --
2010-08-18 15:46 Prakash A S
2010-08-18 15:51 ` Gilles Chanteperdrix
2010-08-19  7:51   ` Prakash A S
2010-08-19  8:01     ` Gilles Chanteperdrix
2010-08-19 10:41       ` Prakash A S
2010-08-19 11:14         ` Gilles Chanteperdrix
2010-08-23  8:44   ` 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=20100812093944.14467.qmail@domain.hid \
    --to=asprakash_83@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.