std::clock()
measures the number of clock ticks within the duration of your program. In the following code, does it calculate the CPU time or wall clock time?
std::clock_t start; double duration;
start = std::clock();
/* Your algorithm here */
duration = ( std::clock() - start ) / (double) CLOCKS_PER_SEC;
In another scenario, with the following code:
std::clock_t start;
double time;
start = std::clock();
time = start / (double) CLOCKS_PER_SEC;
What will the value of time be?
From the documentation:
std::clock
time may advance faster or slower than the wall clock, depending on the execution resources given to the program by the operating system.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With