Measure execution time accurately

Hi all,

I am running some c++ code on linux and want to measure the exact amount of time it takes to run this code.

So far this has been working fine with the function clock.

1
2
3
4
5
double start = clock();

//some code

cout << "execution time = " << clock() - start << endl;


HOWEVER! Now that I have pthreads in my code, this function returns completely wrong results. How can I measure execution time in a different way so that it accounts for that?

thanks.
Topic archived. No new replies allowed.