Increasing Percision of Timer Functions
Mar 10, 2013 at 10:47pm UTC
Hello good people,
I was just wondering if anyone had any advice as to how I can increase the precision of my timer functions? I simply call start timer before an arbitrary function I want timed, and then call stop timer.
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 #include <iostream>
using namespace std;
//some arbitrary function
elapsed = (( double) (stop - start) * 1000) / CLOCKS_PER_SEC;
cout<< "ELAPSED TIME: "<<elapsed<<endl;
It seems that my precision is limited to milliseconds with time.h and the clock() (or is it?):
elapsed = ((
double) (stop - start) * 1000) / CLOCKS_PER_SEC;
Last edited on
Mar 10, 2013 at 10:53pm UTC
Mar 11, 2013 at 12:37am UTC
I now understand that timer resolution is dependant on hardware/OS. Sorry for the silly question.
Topic archived. No new replies allowed.