fixed fullbench behavior

now same as v1.3.5
dev
Yann Collet 2018-08-24 12:40:10 -07:00
parent 4da5bdf482
commit 7b23cc4d1e
1 changed files with 31 additions and 16 deletions

View File

@ -514,24 +514,39 @@ static size_t benchMem(U32 benchNb,
{ size_t i; for (i=0; i<dstBuffSize; i++) dstBuff[i]=(BYTE)i; } { size_t i; for (i=0; i<dstBuffSize; i++) dstBuff[i]=(BYTE)i; }
/* benchmark loop */ /* benchmark loop */
{ void* dstBuffv = dstBuff; { BMK_timedFnState_t* const tfs = BMK_createTimedFnState(g_nbIterations);
BMK_runOutcome_t const outcome = BMK_benchFunction( BMK_runTime_t bestResult;
benchFunction, buff2, bestResult.sumOfReturn = 0;
NULL, NULL, /* initFn */ bestResult.nanoSecPerRun = (unsigned long long)(-1LL);
1, /* blockCount */ for (;;) {
&src, &srcSize, void* const dstBuffv = dstBuff;
&dstBuffv, &dstBuffSize, BMK_timedFnOutcome_t const bOutcome =
NULL, BMK_benchFunctionTimed( tfs,
g_nbIterations); benchFunction, buff2,
if (!BMK_isSuccessful_runOutcome(outcome)) { NULL, NULL, /* initFn */
DISPLAY("ERROR benchmarking function ! ! \n"); 1, /* blockCount */
errorcode = 1; &src, &srcSize,
goto _cleanOut; &dstBuffv, &dstBuffSize,
} NULL);
{ BMK_runTime_t const result = BMK_extract_runTime(outcome); if (!BMK_isSuccessful_timedFnOutcome(bOutcome)) {
DISPLAY("%2u#%-25.25s:%7.1f MB/s (%7u) \n", benchNb, benchName, (double)srcSize * TIMELOOP_NANOSEC / result.nanoSecPerRun / MB_UNIT, (unsigned)result.sumOfReturn ); DISPLAY("ERROR benchmarking function ! ! \n");
errorcode = 1;
goto _cleanOut;
}
{ BMK_runTime_t const newResult = BMK_extract_timedFnResult(bOutcome);
if (newResult.nanoSecPerRun < bestResult.nanoSecPerRun )
bestResult.nanoSecPerRun = newResult.nanoSecPerRun;
DISPLAY("\r%2u#%-29.29s:%8.1f MB/s (%8u) ",
benchNb, benchName,
(double)srcSize * TIMELOOP_NANOSEC / bestResult.nanoSecPerRun / MB_UNIT,
(unsigned)newResult.sumOfReturn );
}
if ( BMK_isCompleted_timedFnOutcome(bOutcome) ) break;
} } } }
DISPLAY("\n");
_cleanOut: _cleanOut:
free(buff1); free(buff1);