I am measuring the time elapsed for a multi-threading program. I already used gettimeofday() and I want to try with clock() now. The problem is I don't get logical results
Effectively I do this on all threads:
so the first thread calculates the time. Though the results are wrong. Am I missing something?Code:pthread_barrier(...); if (threadId == 0) s=clock(); //ALGORITHM pthread_barrier(...); if (threadId == 0) { f=clock(); time = (double)(f - s) / CLOCKS_PER_SEC; }