summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--programs/bench.c6
-rw-r--r--programs/lz4cli.c39
2 files changed, 32 insertions, 13 deletions
diff --git a/programs/bench.c b/programs/bench.c
index c493682..cfd60db 100644
--- a/programs/bench.c
+++ b/programs/bench.c
@@ -122,7 +122,6 @@ void BMK_SetNbSeconds(unsigned nbSeconds)
void BMK_SetBlockSize(size_t blockSize)
{
g_blockSize = blockSize;
- DISPLAYLEVEL(2, "using blocks of size %u KB \n", (U32)(blockSize>>10));
}
@@ -494,6 +493,11 @@ int BMK_benchFiles(const char** fileNamesTable, unsigned nbFiles,
{
double const compressibility = (double)g_compressibilityDefault / 100;
+ if (cLevel > LZ4HC_MAX_CLEVEL) cLevel = LZ4HC_MAX_CLEVEL;
+ if (cLevelLast > LZ4HC_MAX_CLEVEL) cLevelLast = LZ4HC_MAX_CLEVEL;
+ if (cLevelLast < cLevel) cLevelLast = cLevel;
+ if (cLevelLast > cLevel) DISPLAYLEVEL(2, "Benchmarking levels from %d to %d\n", cLevel, cLevelLast);
+
if (nbFiles == 0)
BMK_syntheticTest(cLevel, cLevelLast, compressibility);
else
diff --git a/programs/lz4cli.c b/programs/lz4cli.c
index 1f6b391..1f25a21 100644
--- a/programs/lz4cli.c
+++ b/programs/lz4cli.c
@@ -161,7 +161,7 @@ static int usage_advanced(const char* exeName)
DISPLAY( " -r : operate recursively on directories (sets also -m)\n");
#endif
DISPLAY( " -l : compress using Legacy format (Linux kernel compression)\n");
- DISPLAY( " -B# : Block size [4-7](default : 7)\n");
+ DISPLAY( " -B# : Block size [4-7] (default : 7)\n");
DISPLAY( " -BD : Block dependency (improve compression ratio)\n");
/* DISPLAY( " -BX : enable block checksum (default:disabled)\n"); *//* Option currently inactive */
DISPLAY( "--no-frame-crc : disable stream checksum (default:enabled)\n");
@@ -171,6 +171,8 @@ static int usage_advanced(const char* exeName)
DISPLAY( " -b# : benchmark file(s), using # compression level (default : 1) \n");
DISPLAY( " -e# : test all compression levels from -bX to # (default : 1)\n");
DISPLAY( " -i# : minimum evaluation time in seconds (default : 3s)\n");
+ DISPLAY( " -B# : cut file into independent blocks of size # bytes [32+]\n");
+ DISPLAY( " or predefined block size [4-7] (default: 7)\n");
#if defined(ENABLE_LZ4C_LEGACY_OPTIONS)
DISPLAY( "Legacy arguments :\n");
DISPLAY( " -c0 : fast compression\n");
@@ -417,20 +419,33 @@ int main(int argc, const char** argv)
int exitBlockProperties=0;
switch(argument[1])
{
- case '4':
- case '5':
- case '6':
- case '7':
- { int const B = argument[1] - '0';
- blockSize = LZ4IO_setBlockSizeID(B);
- BMK_setNotificationLevel(displayLevel);
- BMK_SetBlockSize(blockSize);
+ case 'D': LZ4IO_setBlockMode(LZ4IO_blockLinked); argument++; break;
+ case 'X': LZ4IO_setBlockChecksumMode(1); argument ++; break; /* disabled by default */
+ default :
+ if (argument[1] < '0' || argument[1] > '9') {
+ exitBlockProperties=1;
+ break;
+ } else {
+ unsigned B;
argument++;
+ B = readU32FromChar(&argument);
+ argument--;
+ if (B < 4) badusage(exeName);
+ if (B <= 7) {
+ blockSize = LZ4IO_setBlockSizeID(B);
+ BMK_SetBlockSize(blockSize);
+ DISPLAYLEVEL(2, "using blocks of size %u KB \n", (U32)(blockSize>>10));
+ } else {
+ if (B < 32) badusage(exeName);
+ BMK_SetBlockSize(B);
+ if (B >= 1024) {
+ DISPLAYLEVEL(2, "bench: using blocks of size %u KB \n", (U32)(B>>10));
+ } else {
+ DISPLAYLEVEL(2, "bench: using blocks of size %u bytes \n", (U32)(B));
+ }
+ }
break;
}
- case 'D': LZ4IO_setBlockMode(LZ4IO_blockLinked); argument++; break;
- case 'X': LZ4IO_setBlockChecksumMode(1); argument ++; break; /* disabled by default */
- default : exitBlockProperties=1;
}
if (exitBlockProperties) break;
}