All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] Timing calculation
@ 2010-08-12  9:39 prakash srinivasan
  2010-08-12 10:11 ` Eric Noulard
  2010-08-12 11:56 ` Wolfgang Grandegger
  0 siblings, 2 replies; 18+ messages in thread
From: prakash srinivasan @ 2010-08-12  9:39 UTC (permalink / raw)
  To: xenomai

[-- 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 --]

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: [Xenomai-help] Timing calculation
@ 2010-08-18 15:46 Prakash A S
  2010-08-18 15:51 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 18+ messages in thread
From: Prakash A S @ 2010-08-18 15:46 UTC (permalink / raw)
  To: xenomai

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

>
> prakash srinivasan wrote:
> >>>>> printf(TOTAL LOOP TIMING=%ld us\n",
> >>>>> (long)((rt_timer_ticks2ns(end-start))/1000);
> >>>> What does: printf(TOTAL LOOP TIMING=%lld us\n",
> >>>> rt_timer_ticks2ns(end-start)/1000); report.
> >>> TOTAL LOOP TIMING = 5377070 us In this case, the (unsigned)
> >>> (long) (long)tart returns 1069623206 and (unsigned) (long)
> >>> (long)end returns 2151726697
> >> Are you happy with that result? Did really pass approx. 5 seconds
> > between start and end?
>
> Could you format your mails correctly to make them readable? Use text,
> not HTML, truncate at 72 characters, and use > as a quotation mark,
> meaning that one '>' is the sign that you quote someone, two '>' is you
> quoting someone who quoted someone else, etc... I am really sorry to
> have to tell you about this, this is really basic knowledge of the
> netiquette, we should not have to tell you about it.
>
> > Definitely not and I am not confident about this output. Coz in this
> > loop period I am sending datas from client to the server. Visibly
> > noted that the server is getting all the datas within a second. So I
> > am not sure the 5 sec is the right output. I just like to know all
> > the above conversions are correct? and is it ok that the start ticks
> > can be more than the end ticks?
>
> The result of rt_timer_read is a long long, so, if you cast it to an
> unsigned, you loose the most significant bits. So, the result is totally
> meaningless. This again, is basic knowledge of the C language, we should
> not have to explain.
>
> Your bug report is quite insufficient, we do not even know what version
> of Xenomai you use, maybe you are reporting a bug which has been solved
> a long time ago. Neither do we know what version of Linux and of the
> Adoes patch you use, or the contents of your .config file. We do not
> have a self-contained example that we can run to try and reproduce your
> issue.
>
> So if you want some answers, please give us the means to answer you.
>

As an community person I AGREED with what you pointed out. My main
mistake was I subscribed the
mailing list with an useless mailID. Now I changed my mail ID. Surely
you will get the proper
quote in future. In between the mail change, I lost the continuation
for this topic and did not
get this reply mail to my new mail ID. Simply copy and pasted the last
mail from the archive.

Obviously I should improve my C language skills.

I am using linux kernel 2.6.30.8 on Ubuntu 8.04,
Adeos-ipipe-2.6.30.8-x86-2.4-09.patch and Xenomai-2.5.3

-Prakash

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

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

end of thread, other threads:[~2010-08-23  8:44 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-12  9:39 [Xenomai-help] Timing calculation prakash srinivasan
2010-08-12 10:11 ` 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

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.