mirror of
https://github.com/facebook/zstd.git
synced 2025-08-07 06:23:00 +03:00
Display command line parameters with concrete values in verbose mode
This commit is contained in:
@@ -1782,6 +1782,48 @@ FIO_compressFilename_srcFile(FIO_ctx_t* const fCtx,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char* checked_index(const char* options[], size_t length, size_t index) {
|
||||||
|
assert(index < length);
|
||||||
|
return options[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
#define INDEX(options, index) checked_index((options), sizeof(options) / sizeof(char*), (index))
|
||||||
|
|
||||||
|
void FIO_displayCompressionParameters(FIO_prefs_t* const prefs) {
|
||||||
|
static const char* formatOptions[5] = {ZSTD_EXTENSION, GZ_EXTENSION, XZ_EXTENSION,
|
||||||
|
LZMA_EXTENSION, LZ4_EXTENSION};
|
||||||
|
static const char* sparseOptions[3] = {" --no-sparse", "", " --sparse"};
|
||||||
|
static const char* checkSumOptions[3] = {" --no-check", "", " --check"};
|
||||||
|
static const char* rowMatchFinderOptions[3] = {"", " --no-row-match-finder", " --row-match-finder"};
|
||||||
|
static const char* compressLiteralsOptions[3] = {"", " --compress-literals", " --no-compress-literals"};
|
||||||
|
|
||||||
|
assert(g_display_prefs.displayLevel >= 4);
|
||||||
|
|
||||||
|
DISPLAY("--format=%s", formatOptions[prefs->compressionType]);
|
||||||
|
DISPLAY("%s", INDEX(sparseOptions, prefs->sparseFileSupport));
|
||||||
|
DISPLAY("%s", prefs->dictIDFlag ? "" : " --no-dictID");
|
||||||
|
DISPLAY("%s", INDEX(checkSumOptions, prefs->checksumFlag));
|
||||||
|
DISPLAY(" --block-size=%d", prefs->blockSize);
|
||||||
|
if (prefs->adaptiveMode)
|
||||||
|
DISPLAY(" --adapt=min=%d,max=%d", prefs->minAdaptLevel, prefs->maxAdaptLevel);
|
||||||
|
DISPLAY("%s", INDEX(rowMatchFinderOptions, prefs->useRowMatchFinder));
|
||||||
|
DISPLAY("%s", prefs->rsyncable ? " --rsyncable" : "");
|
||||||
|
if (prefs->streamSrcSize)
|
||||||
|
DISPLAY(" --stream-size=%lu", prefs->streamSrcSize);
|
||||||
|
if (prefs->srcSizeHint)
|
||||||
|
DISPLAY(" --size-hint=%d", prefs->srcSizeHint);
|
||||||
|
if (prefs->targetCBlockSize)
|
||||||
|
DISPLAY(" --target-compressed-block-size=%lu", prefs->targetCBlockSize);
|
||||||
|
DISPLAY("%s", INDEX(compressLiteralsOptions, prefs->literalCompressionMode));
|
||||||
|
DISPLAY(" --memory=%u", prefs->memLimit ? prefs->memLimit : 128 MB);
|
||||||
|
DISPLAY(" --threads=%d", prefs->nbWorkers);
|
||||||
|
DISPLAY("%s", prefs->excludeCompressedFiles ? " --exclude-compressed" : "");
|
||||||
|
DISPLAY(" --%scontent-size", prefs->contentSize ? "" : "no-");
|
||||||
|
DISPLAY("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef INDEX
|
||||||
|
|
||||||
int FIO_compressFilename(FIO_ctx_t* const fCtx, FIO_prefs_t* const prefs, const char* dstFileName,
|
int FIO_compressFilename(FIO_ctx_t* const fCtx, FIO_prefs_t* const prefs, const char* dstFileName,
|
||||||
const char* srcFileName, const char* dictFileName,
|
const char* srcFileName, const char* dictFileName,
|
||||||
int compressionLevel, ZSTD_compressionParameters comprParams)
|
int compressionLevel, ZSTD_compressionParameters comprParams)
|
||||||
|
@@ -108,6 +108,7 @@ void FIO_setExcludeCompressedFile(FIO_prefs_t* const prefs, int excludeCompresse
|
|||||||
void FIO_setAllowBlockDevices(FIO_prefs_t* const prefs, int allowBlockDevices);
|
void FIO_setAllowBlockDevices(FIO_prefs_t* const prefs, int allowBlockDevices);
|
||||||
void FIO_setPatchFromMode(FIO_prefs_t* const prefs, int value);
|
void FIO_setPatchFromMode(FIO_prefs_t* const prefs, int value);
|
||||||
void FIO_setContentSize(FIO_prefs_t* const prefs, int value);
|
void FIO_setContentSize(FIO_prefs_t* const prefs, int value);
|
||||||
|
void FIO_displayCompressionParameters(FIO_prefs_t* const prefs);
|
||||||
|
|
||||||
/* FIO_ctx_t functions */
|
/* FIO_ctx_t functions */
|
||||||
void FIO_setNbFilesTotal(FIO_ctx_t* const fCtx, int value);
|
void FIO_setNbFilesTotal(FIO_ctx_t* const fCtx, int value);
|
||||||
|
@@ -1430,6 +1430,8 @@ int main(int argCount, const char* argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_displayLevel >= 4)
|
||||||
|
FIO_displayCompressionParameters(prefs);
|
||||||
if ((filenames->tableSize==1) && outFileName)
|
if ((filenames->tableSize==1) && outFileName)
|
||||||
operationResult = FIO_compressFilename(fCtx, prefs, outFileName, filenames->fileNames[0], dictFileName, cLevel, compressionParams);
|
operationResult = FIO_compressFilename(fCtx, prefs, outFileName, filenames->fileNames[0], dictFileName, cLevel, compressionParams);
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user