I am trying to measure a multi-thread program’s execution time. I’ve use this piece of code in main program for calculating time:
clock_t startTime = clock(); //do stuff clock_t stopTime = clock(); float secsElapsed = (float)(stopTime - startTime)/CLOCKS_PER_SEC;
Now the problem i have is:
for example I run my program with 4 thread(each thread running on one core),
the execution time is 21.39 . I check my system monitor in run time, where the execution time is about 5.3.
It seems that the actual execution time is multiplied by the number of THREADS.
What is the problem??