MCPcopy Create free account
hub / github.com/F-Stack/f-stack / BMK_resetTimedFnState

Function BMK_resetTimedFnState

freebsd/contrib/zstd/programs/benchfn.c:184–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182}
183
184void 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. */

Callers 2

BMK_createTimedFnStateFunction · 0.85

Calls 1

UTIL_getTimeFunction · 0.85

Tested by

no test coverage detected