Timing program processes

theDot

2[H]4U
Joined
Jun 7, 2004
Messages
2,408
Working on a programming project, and I was just wondering if anyone knew of any (preferably Windows) programs or methods to time execution/process time.

I'm just trying to compare some various methods and see what the fastest is (and it's stuff I can't really use big-O analysis for, since it's things like opening textfiles, database searches, where I have limited control over the actual process my application is calling).
 
use a pair of clock_t's:

Code:
clock_t start, end;

start = clock();
// do stuff
end = clock();

printf("time: %lf msec.\n", (double)(end-start) / (double)CLOCKS_PER_SEC * 1000.0);
 
theyre accurate enough, especially if youre using them to compare different implementations, because you can use the same format. in an absolute sense, i dont really know. theyre listed in the gnu c library, among quite a few other places, so they cant be that inaccurate.
 
Back
Top