| 182 | } |
| 183 | |
| 184 | void BMK_resetTimedFnState(BMK_timedFnState_t* timedFnState, unsigned total_ms, unsigned run_ms) |
| 185 | { |
| 186 | if (!total_ms) total_ms = 1 ; |
| 187 | if (!run_ms) run_ms = 1; |
| 188 | if (run_ms > total_ms) run_ms = total_ms; |
| 189 | timedFnState->timeSpent_ns = 0; |
| 190 | timedFnState->timeBudget_ns = (PTime)total_ms * TIMELOOP_NANOSEC / 1000; |
| 191 | timedFnState->runBudget_ns = (PTime)run_ms * TIMELOOP_NANOSEC / 1000; |
| 192 | timedFnState->fastestRun.nanoSecPerRun = (double)TIMELOOP_NANOSEC * 2000000000; /* hopefully large enough : must be larger than any potential measurement */ |
| 193 | timedFnState->fastestRun.sumOfReturn = (size_t)(-1LL); |
| 194 | timedFnState->nbLoops = 1; |
| 195 | timedFnState->coolTime = UTIL_getTime(); |
| 196 | } |
| 197 | |
| 198 | /* Tells if nb of seconds set in timedFnState for all runs is spent. |
| 199 | * note : this function will return 1 if BMK_benchFunctionTimed() has actually errored. */ |
no test coverage detected