2010-02-24 02:36:06     Get time issue

Document created by Aaronwu Employee on Aug 20, 2013
Version 1Show Document
  • View in full screen mode

2010-02-24 02:36:06     Get time issue

cristiana tenti (UNITED STATES)

Message: 86415   

 

Hello everybody,

 

I'm trying to undestand how much time functions in my c code (cross compiled for uclinux on Blackfin 526) take.

 

 

 

In Ubuntu I use gettimeofday( ) function in order to catch time in microsecond.

 

      gettimeofday(&tstart, &ttz);

 

                          [ .... code  ....]

 

   gettimeofday(&tstop, &ttz);

 

   tstop.tv_usec += (tstop.tv_sec - tstart.tv_sec)*1000000 ;

 

   tdiff = tstop.tv_usec - tstart.tv_usec;

 

   printf("tdiff = %ld \n", tdiff);

 

 

 

In my blackfin it works, but differentely from ubuntu: it is not able to take time little then 100 usec:

 

tstart.tv_usec and tstop.tv_usec are always xxx000!

 

So I cannot understand if a function requires less then 100 usec.

 

Do you know the reason of that?

 

do you have some hints that can explain why this function can work on ubuntu and not on blackfin?

 

Do you know an other way to catch this information?

 

 

 

Thank you so much!!

 

best regards!

 

 

 

cristiana

TranslateQuoteReplyEditDelete

 

 

2010-02-24 02:58:51     Re: Get time issue

cristiana tenti (UNITED STATES)

Message: 86417   

 

I forgot to tell you that the CPU frequency is setted at 400 MHz.

 

 

 

Thanks!

TranslateQuoteReplyEditDelete

 

 

2010-02-24 03:19:48     Re: Get time issue

Graf Yang (CHINA)

Message: 86441   

 

You'd select a clocksource, either GPTMR0_CLOCKSOURCE or CYCLES_CLOCKSOURCE

QuoteReplyEditDelete

 

 

2010-02-24 08:21:44     Re: Get time issue

Mike Frysinger (UNITED STATES)

Message: 86454   

 

like Graf said, if your clock source is not tickless, the lowest it can be is the length of the jiffie.  the behavior you show is not a bug but by design.

QuoteReplyEditDelete

 

 

2010-02-24 13:34:37     Re: Get time issue

cristiana tenti (UNITED STATES)

Message: 86478   

 

Thank you for your reply.

 

I didn't understand what I have to set.

 

Have I to add some include or something like take in the top of my code?

 

or is something about linux kernel?

 

 

 

THanks!!!!!

TranslateQuoteReplyEditDelete

 

 

2010-02-24 13:55:41     Re: Get time issue

Mike Frysinger (UNITED STATES)

Message: 86480   

 

Graf already told you the kernel options you need to change in your kernel configuration

Attachments

    Outcomes