Timing in C++

1. #include <ctime>app

2. clock_t clock(void) returns ticks elapsed since the program started. By dividing a macro CLOCK_PER_SEC(usually 1000), you can easily get an approximate time some process has taken.oop

3. time_t time(time_t* timer) returns time as seconds elapsed since midnight, January 1, 1970, or -1 in case of error.get

4. For time approximate to about 100 milliseconds, it is recomended to use a loop for timing. it

actual-time(ms)  = observed-time - baseline-time = 1000/iteration-number-a - 1000/iteration-number-bio

相關文章
相關標籤/搜索