Fix cli no print
Change looping behavior to match old
This commit is contained in:
+3
-30
@@ -818,30 +818,6 @@ static BMK_return_t BMK_benchFileTable(const char* const * const fileNamesTable,
|
||||
}
|
||||
}
|
||||
/* Bench */
|
||||
/*
|
||||
if (adv->separateFiles) {
|
||||
const BYTE* srcPtr = (const BYTE*)srcBuffer;
|
||||
U32 fileNb;
|
||||
res.result.results = (BMK_result_t**)malloc(sizeof(BMK_result_t*) * nbFiles);
|
||||
res.result.nbFiles = nbFiles;
|
||||
if(res.result.results == NULL) EXM_THROW(12, BMK_return_t, "not enough memory");
|
||||
for (fileNb=0; fileNb<nbFiles; fileNb++) {
|
||||
size_t const fileSize = fileSizes[fileNb];
|
||||
BMK_return_t errorOrPtr = BMK_benchCLevel(srcPtr, fileSize,
|
||||
fileSizes+fileNb, 1,
|
||||
cLevel, compressionParams,
|
||||
dictBuffer, dictBufferSize,
|
||||
displayLevel, fileNamesTable[fileNb],
|
||||
adv);
|
||||
if(errorOrPtr.error) {
|
||||
res.error = errorOrPtr.error;
|
||||
return res;
|
||||
}
|
||||
res.result.results[fileNb] = errorOrPtr.result;
|
||||
srcPtr += fileSize;
|
||||
}
|
||||
|
||||
} else */
|
||||
{
|
||||
char mfName[20] = {0};
|
||||
snprintf (mfName, sizeof(mfName), " %u files", nbFiles);
|
||||
@@ -899,12 +875,9 @@ BMK_return_t BMK_benchFilesAdvanced(const char** fileNamesTable, unsigned nbFile
|
||||
{
|
||||
double const compressibility = (double)g_compressibilityDefault / 100;
|
||||
|
||||
if (cLevel > ZSTD_maxCLevel()) cLevel = ZSTD_maxCLevel();
|
||||
/* if (cLevelLast > ZSTD_maxCLevel()) cLevelLast = ZSTD_maxCLevel();
|
||||
if (cLevelLast < cLevel) cLevelLast = cLevel;
|
||||
if (cLevelLast > cLevel)
|
||||
DISPLAYLEVEL(2, "Benchmarking levels from %d to %d\n", cLevel, cLevelLast); */
|
||||
|
||||
if (cLevel > ZSTD_maxCLevel()) {
|
||||
EXM_THROW(15, BMK_return_t, "Invalid Compression Level");
|
||||
}
|
||||
if (nbFiles == 0) {
|
||||
return BMK_syntheticTest(cLevel, compressibility, compressionParams, displayLevel, adv);
|
||||
}
|
||||
|
||||
+10
-6
@@ -75,11 +75,12 @@ typedef struct {
|
||||
BMK_advancedParams_t BMK_initAdvancedParams(void);
|
||||
|
||||
/* called in cli */
|
||||
/* Loads files in fileNamesTable into memory, as well as a dictionary
|
||||
* from dictFileName, and then uses benchMem */
|
||||
/* fileNamesTable - name of files to benchmark
|
||||
* nbFiles - number of files (size of fileNamesTable)
|
||||
* dictFileName - name of dictionary file to load
|
||||
* cLevel - lowest compression level to benchmark
|
||||
* cLevellast - highest compression level to benchmark (everything in the range [cLevel, cLevellast]) will be benchmarked
|
||||
* cLevel - compression level to benchmark, errors if invalid
|
||||
* compressionParams - basic compression Parameters
|
||||
* displayLevel - what gets printed
|
||||
* 0 : no display;
|
||||
@@ -103,15 +104,18 @@ BMK_return_t BMK_benchFilesAdvanced(const char** fileNamesTable, unsigned nbFile
|
||||
int cLevel, const ZSTD_compressionParameters* compressionParams,
|
||||
int displayLevel, const BMK_advancedParams_t* const adv);
|
||||
|
||||
/* basic benchmarking function, called in paramgrill ctx, dctx must be provided */
|
||||
/* basic benchmarking function, called in paramgrill
|
||||
* applies ZSTD_compress_generic() and ZSTD_decompress_generic() on data in srcBuffer
|
||||
* with specific compression parameters specified by other arguments using benchFunction
|
||||
* (cLevel, comprParams + adv in advanced Mode) */
|
||||
/* srcBuffer - data source, expected to be valid compressed data if in Decode Only Mode
|
||||
* srcSize - size of data in srcBuffer
|
||||
* cLevel - compression level
|
||||
* comprParams - basic compression parameters
|
||||
* dictBuffer - a dictionary if used, null otherwise
|
||||
* dictBufferSize - size of dictBuffer, 0 otherwise
|
||||
* ctx - Compression Context
|
||||
* dctx - Decompression Context
|
||||
* ctx - Compression Context (must be provided)
|
||||
* dctx - Decompression Context (must be provided)
|
||||
* diplayLevel - see BMK_benchFiles
|
||||
* displayName - name used by display
|
||||
* return
|
||||
@@ -135,7 +139,7 @@ BMK_return_t BMK_benchMemAdvanced(const void* srcBuffer, size_t srcSize,
|
||||
int displayLevel, const char* displayName,
|
||||
const BMK_advancedParams_t* adv);
|
||||
|
||||
/* This function benchmarks the running time two functions (function specifics described */
|
||||
/* This function times the execution of 2 argument functions, benchFn and initFn */
|
||||
|
||||
/* benchFn - (*benchFn)(srcBuffers[i], srcSizes[i], dstBuffers[i], dstCapacities[i], benchPayload)
|
||||
* is run a variable number of times, specified by mode and iter args
|
||||
|
||||
+18
-8
@@ -32,7 +32,7 @@
|
||||
#include <errno.h> /* errno */
|
||||
#include "fileio.h" /* stdinmark, stdoutmark, ZSTD_EXTENSION */
|
||||
#ifndef ZSTD_NOBENCH
|
||||
# include "bench.h" /* BMK_benchFiles, BMK_SetNbSeconds */
|
||||
# include "bench.h" /* BMK_benchFiles */
|
||||
#endif
|
||||
#ifndef ZSTD_NODICT
|
||||
# include "dibio.h" /* ZDICT_cover_params_t, DiB_trainFromFiles() */
|
||||
@@ -816,15 +816,25 @@ int main(int argCount, const char* argv[])
|
||||
adv.ldmHashEveryLog = g_ldmHashEveryLog;
|
||||
}
|
||||
|
||||
for(; cLevel <= cLevelLast; cLevel++) {
|
||||
if(separateFiles) {
|
||||
unsigned i;
|
||||
for(i = 0; i < filenameIdx; i++) {
|
||||
BMK_benchFilesAdvanced(&filenameTable[i], 1, dictFileName, cLevel, &compressionParams, g_displayLevel, &adv);
|
||||
if (cLevel > ZSTD_maxCLevel()) cLevel = ZSTD_maxCLevel();
|
||||
if (cLevelLast > ZSTD_maxCLevel()) cLevelLast = ZSTD_maxCLevel();
|
||||
if (cLevelLast < cLevel) cLevelLast = cLevel;
|
||||
if (cLevelLast > cLevel)
|
||||
DISPLAYLEVEL(2, "Benchmarking levels from %d to %d\n", cLevel, cLevelLast);
|
||||
|
||||
if(separateFiles) {
|
||||
unsigned i;
|
||||
for(i = 0; i < filenameIdx; i++) {
|
||||
DISPLAYLEVEL(2, "Benchmarking %s \n", filenameTable[i]);
|
||||
int c;
|
||||
for(c = cLevel; c <= cLevelLast; c++) {
|
||||
BMK_benchFilesAdvanced(&filenameTable[i], 1, dictFileName, c, &compressionParams, g_displayLevel, &adv);
|
||||
}
|
||||
} else {
|
||||
BMK_benchFilesAdvanced(filenameTable, filenameIdx, dictFileName, cLevel, &compressionParams, g_displayLevel, &adv);
|
||||
}
|
||||
} else {
|
||||
for(; cLevel <= cLevelLast; cLevel++) {
|
||||
BMK_benchFilesAdvanced(filenameTable, filenameIdx, dictFileName, cLevel, &compressionParams, g_displayLevel, &adv);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user