mirror of
https://github.com/facebook/zstd.git
synced 2025-12-16 00:04:14 -05:00
Merge pull request #1284 from GeorgeLu97/negativeLvlDisplay
Fix negative lvl display value
This commit is contained in:
commit
77fa1d6e42
@ -104,7 +104,8 @@ Full list of arguments
|
|||||||
t# - targetLength
|
t# - targetLength
|
||||||
S# - strategy
|
S# - strategy
|
||||||
L# - level
|
L# - level
|
||||||
--zstd= : Single run, parameter selection syntax same as zstdcli.
|
--zstd= : Single run, parameter selection syntax same as zstdcli with more parameters
|
||||||
|
(Added forceAttachDictionary / fadt)
|
||||||
When invoked with --optimize, this represents the sample to exceed.
|
When invoked with --optimize, this represents the sample to exceed.
|
||||||
--optimize= : find parameters to maximize compression ratio given parameters
|
--optimize= : find parameters to maximize compression ratio given parameters
|
||||||
Can use all --zstd= commands to constrain the type of solution found in addition to the following constraints
|
Can use all --zstd= commands to constrain the type of solution found in addition to the following constraints
|
||||||
@ -120,18 +121,23 @@ Full list of arguments
|
|||||||
when determining overall winner (default 5 (1% ratio = 5% speed)).
|
when determining overall winner (default 5 (1% ratio = 5% speed)).
|
||||||
tries= : Maximum number of random restarts on a single strategy before switching (Default 5)
|
tries= : Maximum number of random restarts on a single strategy before switching (Default 5)
|
||||||
Higher values will make optimizer run longer, more chances to find better solution.
|
Higher values will make optimizer run longer, more chances to find better solution.
|
||||||
memLog : Limits the log of the size of each memotable (1 per strategy). Setting memLog = 0 turns off memoization
|
memLog : Limits the log of the size of each memotable (1 per strategy). Will use hash tables when state space is larger than max size.
|
||||||
|
Setting memLog = 0 turns off memoization
|
||||||
--display= : specifiy which parameters are included in the output
|
--display= : specifiy which parameters are included in the output
|
||||||
can use all --zstd parameter names and 'cParams' as a shorthand for all parameters used in ZSTD_compressionParameters
|
can use all --zstd parameter names and 'cParams' as a shorthand for all parameters used in ZSTD_compressionParameters
|
||||||
(Default: display all params available)
|
(Default: display all params available)
|
||||||
|
-P# : generated sample compressibility (when no file is provided)
|
||||||
-P# : generated sample compressibility
|
|
||||||
-t# : Caps runtime of operation in seconds (default : 99999 seconds (about 27 hours ))
|
-t# : Caps runtime of operation in seconds (default : 99999 seconds (about 27 hours ))
|
||||||
-v : Prints Benchmarking output
|
-v : Prints Benchmarking output
|
||||||
-D : Next argument dictionary file
|
-D : Next argument dictionary file
|
||||||
-s : Benchmark all files separately
|
-s : Benchmark all files separately
|
||||||
-q : Quiet, repeat for more quiet
|
-q : Quiet, repeat for more quiet
|
||||||
|
-q Prints parameters + results whenever a new best is found
|
||||||
|
-qq Only prints parameters whenever a new best is found, prints final parameters + results
|
||||||
|
-qqq Only print final parameters + results
|
||||||
|
-qqqq Only prints final parameter set in the form --zstd=
|
||||||
-v : Verbose, cancels quiet, repeat for more volume
|
-v : Verbose, cancels quiet, repeat for more volume
|
||||||
|
-v Prints all candidate parameters and results
|
||||||
|
|
||||||
```
|
```
|
||||||
Any inputs afterwards are treated as files to benchmark.
|
Any inputs afterwards are treated as files to benchmark.
|
||||||
|
|||||||
@ -655,7 +655,7 @@ static void BMK_displayOneResult(FILE* f, winnerInfo_t res, const size_t srcSize
|
|||||||
|
|
||||||
/* Writes to f the results of a parameter benchmark */
|
/* Writes to f the results of a parameter benchmark */
|
||||||
/* when used with --optimize, will only print results better than previously discovered */
|
/* when used with --optimize, will only print results better than previously discovered */
|
||||||
static void BMK_printWinner(FILE* f, const U32 cLevel, const BMK_result_t result, const paramValues_t params, const size_t srcSize)
|
static void BMK_printWinner(FILE* f, const int cLevel, const BMK_result_t result, const paramValues_t params, const size_t srcSize)
|
||||||
{
|
{
|
||||||
char lvlstr[15] = "Custom Level";
|
char lvlstr[15] = "Custom Level";
|
||||||
winnerInfo_t w;
|
winnerInfo_t w;
|
||||||
@ -665,7 +665,7 @@ static void BMK_printWinner(FILE* f, const U32 cLevel, const BMK_result_t result
|
|||||||
fprintf(f, "\r%79s\r", "");
|
fprintf(f, "\r%79s\r", "");
|
||||||
|
|
||||||
if(cLevel != CUSTOM_LEVEL) {
|
if(cLevel != CUSTOM_LEVEL) {
|
||||||
snprintf(lvlstr, 15, " Level %2u ", cLevel);
|
snprintf(lvlstr, 15, " Level %2d ", cLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(TIMED) {
|
if(TIMED) {
|
||||||
@ -1865,8 +1865,9 @@ static void BMK_benchFullTable(const buffers_t buf, const contexts_t ctx)
|
|||||||
* Single Benchmark Functions
|
* Single Benchmark Functions
|
||||||
**************************************/
|
**************************************/
|
||||||
|
|
||||||
static int benchOnce(const buffers_t buf, const contexts_t ctx) {
|
static int benchOnce(const buffers_t buf, const contexts_t ctx, const int cLevel) {
|
||||||
BMK_result_t testResult;
|
BMK_result_t testResult;
|
||||||
|
g_params = adjustParams(overwriteParams(cParamsToPVals(ZSTD_getCParams(cLevel, buf.maxBlockSize, ctx.dictSize)), g_params), buf.maxBlockSize, ctx.dictSize);
|
||||||
|
|
||||||
if(BMK_benchParam(&testResult, buf, ctx, g_params)) {
|
if(BMK_benchParam(&testResult, buf, ctx, g_params)) {
|
||||||
DISPLAY("Error during benchmarking\n");
|
DISPLAY("Error during benchmarking\n");
|
||||||
@ -1878,7 +1879,7 @@ static int benchOnce(const buffers_t buf, const contexts_t ctx) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int benchSample(double compressibility)
|
static int benchSample(double compressibility, int cLevel)
|
||||||
{
|
{
|
||||||
const char* const name = "Sample 10MB";
|
const char* const name = "Sample 10MB";
|
||||||
size_t const benchedSize = 10 MB;
|
size_t const benchedSize = 10 MB;
|
||||||
@ -1912,7 +1913,7 @@ static int benchSample(double compressibility)
|
|||||||
DISPLAY("using %s %i%%: \n", name, (int)(compressibility*100));
|
DISPLAY("using %s %i%%: \n", name, (int)(compressibility*100));
|
||||||
|
|
||||||
if(g_singleRun) {
|
if(g_singleRun) {
|
||||||
ret = benchOnce(buf, ctx);
|
ret = benchOnce(buf, ctx, cLevel);
|
||||||
} else {
|
} else {
|
||||||
BMK_benchFullTable(buf, ctx);
|
BMK_benchFullTable(buf, ctx);
|
||||||
}
|
}
|
||||||
@ -1926,7 +1927,7 @@ static int benchSample(double compressibility)
|
|||||||
/* benchFiles() :
|
/* benchFiles() :
|
||||||
* note: while this function takes a table of filenames,
|
* note: while this function takes a table of filenames,
|
||||||
* in practice, only the first filename will be used */
|
* in practice, only the first filename will be used */
|
||||||
int benchFiles(const char** fileNamesTable, int nbFiles, const char* dictFileName, int cLevel)
|
int benchFiles(const char** fileNamesTable, int nbFiles, const char* dictFileName, const int cLevel)
|
||||||
{
|
{
|
||||||
buffers_t buf;
|
buffers_t buf;
|
||||||
contexts_t ctx;
|
contexts_t ctx;
|
||||||
@ -1950,10 +1951,8 @@ int benchFiles(const char** fileNamesTable, int nbFiles, const char* dictFileNam
|
|||||||
DISPLAY("using %d Files : \n", nbFiles);
|
DISPLAY("using %d Files : \n", nbFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_params = adjustParams(overwriteParams(cParamsToPVals(ZSTD_getCParams(cLevel, buf.maxBlockSize, ctx.dictSize)), g_params), buf.maxBlockSize, ctx.dictSize);
|
|
||||||
|
|
||||||
if(g_singleRun) {
|
if(g_singleRun) {
|
||||||
ret = benchOnce(buf, ctx);
|
ret = benchOnce(buf, ctx, cLevel);
|
||||||
} else {
|
} else {
|
||||||
BMK_benchFullTable(buf, ctx);
|
BMK_benchFullTable(buf, ctx);
|
||||||
}
|
}
|
||||||
@ -2731,7 +2730,7 @@ int main(int argc, const char** argv)
|
|||||||
DISPLAY("Optimizer Expects File\n");
|
DISPLAY("Optimizer Expects File\n");
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
result = benchSample(compressibility);
|
result = benchSample(compressibility, cLevelRun);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(seperateFiles) {
|
if(seperateFiles) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user