AnsweredAssumed Answered

Milliseconds in Blackfin

Question asked by NTan on Sep 25, 2013
Latest reply on Sep 25, 2013 by NTan

Good Day Everyone!

 

I would just want to ask how to measure the time elapsed (in micro/milliseconds) when executing my C++ code in blackfin. I tried using the <time.h> of the C library, but the milliseconds returned is inaccurate. Below is the code I used:

 

  //Time elapsed (in milliseconds)

          float millis;

          float total = 0.0;

          float ave;

          clock_t start, stop;

 

     start = clock();

     aReading =  getITG3200(1);

     fReading = filterITG3200(aReading); 

     stop = clock();

     millis = (((float)stop - (float)start)/CLOCKS_PER_SEC) * 1000;   //where CLOCKS_PER_SEC is a constant in the library <time.h>

                                                                                                 //CLOCKS_PER_SEC = 5,000,000 (depending on the system)

 

Basically, I want to know how many microseconds or milliseconds it takes to execute the code in red (aReading and fReading).  Is there anyway this can be done in blackfin? I am using a BF537 EZ Kit Lite and Visual DSP++.

 

Thank you!


Regards,

Nicole

Outcomes