Hi Pete,
> 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.
Try using the gettimeofday function.
<
http://linux.die.net/man/2/gettimeofday>
On some version of linux (running on the PXA processors) this will
return sub-microsecond resolution, while on others it will return 10
millisecond resolution.
Note that gettimeofday will return wall time, as opposed to processor time.
You may also want to look at the times function:
<
http://linux.die.net/man/2/times>
--
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/-------------------------------------------------------------------------
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