So I wanted to know how long my code takes to run on the order of seconds, so I know about the gprof profiling tool and have used this before.. but for now I just want to use the clock() functions
(And from my experience gprof reports faster times anyways)
So basically I am rendering somethign on screen - and when I just look at it running and count in my head the seconds it takes to run I can count about 7 seconds..
But when I time it using
clock1 = clock();
RunOneCardiacCycle( ourMeshExpert, SAMVoxelGrid, timeSampleSet);
clock2 = clock();
printf("Time = %.5f\t",(double)(clock2 - clock1) / CLOCKS_PER_SEC);
it reports an average of about 0.6-0.7 seconds!!!
This makes no sense to me..
I know clock() is not very accurate but I thought it woudl be at least accurate to the order of seconds..?
Is it because i have many windows open? This can't make such a huge difference!! Do the above lines of code look right? It shoudl output time in seconds right?