This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Time Stamp Counter

Other Parts Discussed in Thread: OMAP3530

Hello there!

 

Does anyone know if the OMAP includes a  Time Stamp Counter, like all new x86 processors have, and how it can be accessed?

 

I am working on some algorithms in C, and a Time Stamp Counter would be a great thing to measure their speed.

 

Maybe its access is even already implemented into the kernel, but I don’t know.

 

Best regards

Sebastian Kruber

  • Sebastian Kruber said:
    Does anyone know if the OMAP includes a  Time Stamp Counter, like all new x86 processors have, and how it can be accessed?

    The OMAP3 has a number of timers, though none go by the name 'time stamp counter' they can be used for a similar effect. You should not have to worry about the timer itself if you are running Linux, you should be able to just access the value using a clock_gettime() call, though I have not tried this myself I believe it works.

  • Hello Bernie!

    Yes, the function clock_gettime works! It even resolves the time down to nanoseconds.

    This is of great help! Thanks!

    Sebastian

  • Hello,

    I am currently using linux-2.6.32 on OMAP3530 and I would like to make some measures on it. I am writting to you because the function clock_gettime() is not enough precise.

    I mean that I have observed that the value returned by clock_gettime() is updated every tick, that's why it is impossible for me to measure precisely what I want ( my times are from 50ns to 500us)

    Do you have any idea to resolve this?

    Thank you very much by advance!

    Etienne

  • One suggestion is to change the kernel configuration so that the System timer uses a GPTIMER instead of the 32KHz timer. To do this you have to change a kernel configuration option and then rebuild the kernel. Start in the kernel tree and do

    make menuconfig

    Then select System Type, select TI OMAP Implementations, scroll down to System timer and select it. Finally select Use mpu timer. Save your changes and rebuild the kernel with

    make uImage

    Boot your new kernel and clock_gettime() should give you more granularity.

    Steve K.

  • It works fine, thank you very much for your answer !

     

  • HMM..  When I call clock_gettime() I just get nanosecond values that are updated once per second.   Using L138 and latest DVSDK/Linux.

    i.e.  if we call this function in a loop (divided into milliseconds in this example)  we see...

    idle 1301157061000

    idle 1301157061000

    and eventually when one second has passed... 

    idle 1301157062000

    idle 1301157062000

    etc..

    Bob