From bf1856c26ff9c25dd0f7d92407674593ad926e0d Mon Sep 17 00:00:00 2001 From: Bimba Shrestha Date: Fri, 3 Apr 2020 12:07:17 -0700 Subject: [PATCH 1/2] removing max(1, ..) --- programs/fileio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/fileio.c b/programs/fileio.c index b8194ad6132..6dd99f0fe35 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -1389,7 +1389,7 @@ FIO_compressFilename_internal(FIO_prefs_t* const prefs, DISPLAYLEVEL(2, "\r%79s\r", ""); DISPLAYLEVEL(2,"%-20s :%6.2f%% (%6llu => %6llu bytes, %s) \n", srcFileName, - (double)compressedfilesize / (readsize+(!readsize)/*avoid div by zero*/) * 100, + (double)compressedfilesize / readsize * 100, (unsigned long long)readsize, (unsigned long long) compressedfilesize, dstFileName); From d0412f3abae899b368f74e98b36cd26d26d9c540 Mon Sep 17 00:00:00 2001 From: Bimba Shrestha Date: Fri, 3 Apr 2020 12:10:02 -0700 Subject: [PATCH 2/2] no percentage on readsize == 0 --- programs/fileio.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/programs/fileio.c b/programs/fileio.c index 6dd99f0fe35..f2ae1bd44bb 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -1387,11 +1387,18 @@ FIO_compressFilename_internal(FIO_prefs_t* const prefs, /* Status */ DISPLAYLEVEL(2, "\r%79s\r", ""); - DISPLAYLEVEL(2,"%-20s :%6.2f%% (%6llu => %6llu bytes, %s) \n", - srcFileName, - (double)compressedfilesize / readsize * 100, - (unsigned long long)readsize, (unsigned long long) compressedfilesize, - dstFileName); + if (readsize == 0) { + DISPLAYLEVEL(2,"%-20s : (%6llu => %6llu bytes, %s) \n", + srcFileName, + (unsigned long long)readsize, (unsigned long long) compressedfilesize, + dstFileName); + } else { + DISPLAYLEVEL(2,"%-20s :%6.2f%% (%6llu => %6llu bytes, %s) \n", + srcFileName, + (double)compressedfilesize / readsize * 100, + (unsigned long long)readsize, (unsigned long long) compressedfilesize, + dstFileName); + } /* Elapsed Time and CPU Load */ { clock_t const cpuEnd = clock();