I'm trying to measure some activity in C (Matrix multiplying) and noticed that I should do something like this:
clock_t start = clock();
sleep(3);
clock_t end = clock();
double elapsed_time = (end - start)/(double)CLOCKS_PER_SEC;
printf("Elapsed time: %.2f.\n", elapsed_time);
The output is:
Elapsed time: 0.00.
Why is this happening?
(end - start)
? – Opinionatedclock
vs. eg.time
. Buttime
will not help with his measuring 'matrix multiplication.' – Coachwork