]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Use human_size() on the "multiple files compressed" output also
authorScott Baker <scott@perturb.org>
Sat, 5 Jun 2021 05:21:00 +0000 (22:21 -0700)
committerW. Felix Handte <w@felixhandte.com>
Thu, 10 Jun 2021 16:53:07 +0000 (12:53 -0400)
programs/fileio.c

index b347da423de51d7224c65bfd809411811a1b1ce1..7432348c0c7798f096cee829ddfb4de1637ca15c 100644 (file)
@@ -1841,6 +1841,8 @@ int FIO_compressMultipleFilenames(FIO_ctx_t* const fCtx,
 {
     int status;
     int error = 0;
+       char inputSizeStr[8]  = "";
+       char outputSizeStr[8] = "";
     cRess_t ress = FIO_createCResources(prefs, dictFileName,
         FIO_getLargestFileSize(inFileNamesTable, (unsigned)fCtx->nbFilesTotal),
         compressionLevel, comprParams);
@@ -1896,10 +1898,13 @@ int FIO_compressMultipleFilenames(FIO_ctx_t* const fCtx,
     }
 
     if (fCtx->nbFilesProcessed >= 1 && fCtx->nbFilesTotal > 1 && fCtx->totalBytesInput != 0) {
+               humanSize((unsigned long long) fCtx->totalBytesInput, inputSizeStr);
+               humanSize((unsigned long long) fCtx->totalBytesOutput, outputSizeStr);
+
         DISPLAYLEVEL(2, "\r%79s\r", "");
-        DISPLAYLEVEL(2, "%d files compressed : %.2f%%  (%6zu => %6zu bytes)\n", fCtx->nbFilesProcessed,
+        DISPLAYLEVEL(2, "%3d files compressed : %.2f%%   (%s => %s bytes)\n", fCtx->nbFilesProcessed,
                         (double)fCtx->totalBytesOutput/((double)fCtx->totalBytesInput)*100,
-                        fCtx->totalBytesInput, fCtx->totalBytesOutput);
+                        inputSizeStr, outputSizeStr);
     }
 
     FIO_freeCResources(&ress);