From daebc7fe26f70896c3a51d96f287012128b4ce36 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Sat, 18 Nov 2017 15:54:32 -0800 Subject: [PATCH] bench: slightly adjusted display format adapt accuracy depending on value. makes it possible to have higher accuracy for small value, notably small compression speed. This capability is expected to be useful while modifying optimal parser. --- programs/bench.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/programs/bench.c b/programs/bench.c index 27952169f..1df8aeb0d 100644 --- a/programs/bench.c +++ b/programs/bench.c @@ -356,9 +356,14 @@ static int BMK_benchMem(const void* srcBuffer, size_t srcSize, { U32 blockNb; for (blockNb=0; blockNb%10u (%5.3f),%6.1f MB/s\r", - marks[markNb], displayName, (U32)srcSize, (U32)cSize, - ratio, (double)srcSize / fastestC ); + { int const ratioAccuracy = (ratio < 10.) ? 3 : 2; + double const compressionSpeed = (double)srcSize / fastestC; + int const cSpeedAccuracy = (compressionSpeed < 10.) ? 2 : 1; + DISPLAYLEVEL(2, "%2s-%-17.17s :%10u ->%10u (%5.*f),%6.*f MB/s\r", + marks[markNb], displayName, (U32)srcSize, (U32)cSize, + ratioAccuracy, ratio, + cSpeedAccuracy, compressionSpeed ); + } } else { /* g_decodeOnly */ memcpy(compressedBuffer, srcBuffer, loadedCompressedSize); } @@ -403,10 +408,16 @@ static int BMK_benchMem(const void* srcBuffer, size_t srcSize, } } markNb = (markNb+1) % NB_MARKS; - DISPLAYLEVEL(2, "%2s-%-17.17s :%10u ->%10u (%5.3f),%6.1f MB/s ,%6.1f MB/s\r", - marks[markNb], displayName, (U32)srcSize, (U32)cSize, ratio, - (double)srcSize / fastestC, - (double)srcSize / fastestD ); + { int const ratioAccuracy = (ratio < 10.) ? 3 : 2; + double const compressionSpeed = (double)srcSize / fastestC; + int const cSpeedAccuracy = (compressionSpeed < 10.) ? 2 : 1; + double const decompressionSpeed = (double)srcSize / fastestD; + DISPLAYLEVEL(2, "%2s-%-17.17s :%10u ->%10u (%5.*f),%6.*f MB/s ,%6.1f MB/s \r", + marks[markNb], displayName, (U32)srcSize, (U32)cSize, + ratioAccuracy, ratio, + cSpeedAccuracy, compressionSpeed, + decompressionSpeed); + } /* CRC Checking */ { U64 const crcCheck = XXH64(resultBuffer, srcSize, 0); @@ -448,7 +459,7 @@ static int BMK_benchMem(const void* srcBuffer, size_t srcSize, #endif } /* for (testNb = 1; testNb <= (g_nbSeconds + !g_nbSeconds); testNb++) */ - if (g_displayLevel == 1) { + if (g_displayLevel == 1) { /* hidden display mode -q, used by python speed benchmark */ double cSpeed = (double)srcSize / fastestC; double dSpeed = (double)srcSize / fastestD; if (g_additionalParam)