Merge pull request #2068 from bimbashrestha/quick

[bug] Fixing Incorrect/inconsistent reported compression percentage for empty files
This commit is contained in:
Bimba Shrestha
2020-04-03 19:28:42 -05:00
committed by GitHub
+12 -5
View File
@@ -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();