Skip to content

Commit

Permalink
Merge pull request #2068 from bimbashrestha/quick
Browse files Browse the repository at this point in the history
[bug] Fixing Incorrect/inconsistent reported compression percentage for empty files
  • Loading branch information
Bimba Shrestha authored Apr 4, 2020
2 parents 009a92f + d0412f3 commit ebc422b
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions programs/fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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+(!readsize)/*avoid div by zero*/) * 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();
Expand Down

0 comments on commit ebc422b

Please sign in to comment.