DSPRelated.com
Forums

How to measure time accurately

Started by Yong Yang June 23, 2004
Hi, all
 
I want to measure time accurately so that I can derive frame rate of my encoder. But the clock() function does not work well in CCS. So now I can only use time() function that only gets time in seconds. Any other ways to measure time accurately?
 
Thanks
 
Yong



Hi Yong,
 
Have you tried using BIOS STS for this?  I've used STS module a lot for this kind of benchmarking, and found it helpful for gathering data over multiple iterations for getting max and average time data.  You can use the STS module with the CLK module as follows :-
 
 
    #include <std.h>
    #include <sts.h>
    #include <clk.h>
 
    extern far STS_Obj myStsTime;    // [Create an STS Obj in the CDB file] externally reference this object
 
    ...
 
 
    STS_set(&myStsTime, CLK_gethtime());    // Get the value of the high resolution timer (cpuclk/4 or /8), put this in an STS Obj
 
    process();    // Function or code to measure
 
    STS_delta(&myStsTime, CLK_gethtime());    // Get the value of the high resolution timer (cpuclk/4 or /8), take diff and put in STS Obj
 
 
The other nice thing about this is that it doesn't stop the dsp to grab the time, and hence should work in your real-time system.
 
Hope this helps,
 
raj
 
 
 
----- Original Message -----
From: Yong Yang
To: c...@yahoogroups.com ; c...@yahoogroups.com
Sent: Wednesday, June 23, 2004 3:58 AM
Subject: [code-comp] How to measure time accurately

Hi, all
 
I want to measure time accurately so that I can derive frame rate of my encoder. But the clock() function does not work well in CCS. So now I can only use time() function that only gets time in seconds. Any other ways to measure time accurately?
 
Thanks
 
Yong



Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer.  You need to do a "reply all" if you want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join:  c...@yahoogroups.com

To Post:  c...@yahoogroups.com

To Leave: c...@yahoogroups.com

Archives: http://www.yahoogroups.com/group/code-comp

More Groups: http://www.dsprelated.com