+ 5
Performance Testing In C
Is there an easy-to-use function to do simple performance tests here on Sololearn? I read that time() isn't precise enough for that...
4 Answers
+ 4
ChillPill , did you have a code here for timing functions?
+ 3
I found this which check the time taken for a function
#include <time.h>
clock_t start, end;
double cpu_time_used;
start = clock();
... /* Do the work. */
end = clock();
cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC;
+ 2
*AsterisK*, clock, like time, seems to only return seconds but not milliseconds.
I wonder if there's anything else...
+ 2
HonFu I tested with 4 methods(except time()), sadly none worked heređ€
and FYI: clock doesn't return seconds but somehow SL servers behave that wayâŠ