1
0
mirror of https://github.com/facebook/zstd.git synced 2025-07-29 11:21:22 +03:00

bench: better result alignment

when displaying ratios > x100
This commit is contained in:
Yann Collet
2025-01-30 21:30:48 -08:00
parent 283fbd2dca
commit 60f84f73fe

View File

@ -633,7 +633,7 @@ static BMK_benchOutcome_t BMK_benchMemAdvancedNoAlloc(
} }
{ {
int const ratioAccuracy = (ratio < 10.) ? 3 : 2; int const ratioDigits = 1 + (ratio < 100.) + (ratio < 10.);
assert(cSize < UINT_MAX); assert(cSize < UINT_MAX);
OUTPUTLEVEL( OUTPUTLEVEL(
2, 2,
@ -642,7 +642,7 @@ static BMK_benchOutcome_t BMK_benchMemAdvancedNoAlloc(
displayName, displayName,
(unsigned)srcSize, (unsigned)srcSize,
(unsigned)cSize, (unsigned)cSize,
ratioAccuracy, ratioDigits,
ratio, ratio,
benchResult.cSpeed < (10 * MB_UNIT) ? 2 : 1, benchResult.cSpeed < (10 * MB_UNIT) ? 2 : 1,
(double)benchResult.cSpeed / MB_UNIT); (double)benchResult.cSpeed / MB_UNIT);
@ -669,7 +669,7 @@ static BMK_benchOutcome_t BMK_benchMemAdvancedNoAlloc(
} }
{ {
int const ratioAccuracy = (ratio < 10.) ? 3 : 2; int const ratioDigits = 1 + (ratio < 100.) + (ratio < 10.);
OUTPUTLEVEL( OUTPUTLEVEL(
2, 2,
"%2s-%-17.17s :%10u ->%10u (x%5.*f), %6.*f MB/s, %6.1f MB/s\r", "%2s-%-17.17s :%10u ->%10u (x%5.*f), %6.*f MB/s, %6.1f MB/s\r",
@ -677,7 +677,7 @@ static BMK_benchOutcome_t BMK_benchMemAdvancedNoAlloc(
displayName, displayName,
(unsigned)srcSize, (unsigned)srcSize,
(unsigned)cSize, (unsigned)cSize,
ratioAccuracy, ratioDigits,
ratio, ratio,
benchResult.cSpeed < (10 * MB_UNIT) ? 2 : 1, benchResult.cSpeed < (10 * MB_UNIT) ? 2 : 1,
(double)benchResult.cSpeed / MB_UNIT, (double)benchResult.cSpeed / MB_UNIT,