« Return to Thread: Measuring Execution Time

Measuring Execution Time

by Peter Vandrish :: Rate this Message:

Reply to Author | View in Thread

Hi,
I am trying to measure the execution time of my program using the following code:
#include <ctime>
clock_t start,finish;
double time;

start = clock();
sort something
finish = clock();

time = (double(finish)-double(start))/CLOCKS_PER_SEC;

It does not seem accurate at all. It reports that the Gumstix CLOCKS_PER_SECOND is 1000000.

It also tells me the double(finish) is 30000 and the double(start) is 20000, it doesnt seem likely

that my program executes in a nice round number of 10000 CLOCK TICKS.

Does anyone know hoe I can do this well.

Thanks,

Pete



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
gumstix-users mailing list
gumstix-users@...
https://lists.sourceforge.net/lists/listinfo/gumstix-users

 « Return to Thread: Measuring Execution Time

LightInTheBox - Buy quality products at wholesale price!