summaryrefslogtreecommitdiffstats
path: root/programs/bench.c
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2022-07-29 20:13:38 (GMT)
committerYann Collet <cyan@fb.com>2022-07-29 20:13:38 (GMT)
commitf01b7b5209c447acdee0db817f239e9925497329 (patch)
treee4a1c12db670a94ca55ffdcf4c133e0d0066de52 /programs/bench.c
parente8f0baa3f9bef8976aefc7c6fb9f0e3e6b5d7215 (diff)
downloadlz4-f01b7b5209c447acdee0db817f239e9925497329.zip
lz4-f01b7b5209c447acdee0db817f239e9925497329.tar.gz
lz4-f01b7b5209c447acdee0db817f239e9925497329.tar.bz2
can select validation of CRC during benchmark
on command line, using existing long command --no-frame-crc. Note : it's effectively more than that, since _all_ checksums are disabled.
Diffstat (limited to 'programs/bench.c')
-rw-r--r--programs/bench.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/programs/bench.c b/programs/bench.c
index 7836717..00de426 100644
--- a/programs/bench.c
+++ b/programs/bench.c
@@ -123,6 +123,7 @@ static size_t g_blockSize = 0;
int g_additionalParam = 0;
int g_benchSeparately = 0;
int g_decodeOnly = 0;
+unsigned g_skipChecksums = 0;
void BMK_setNotificationLevel(unsigned level) { g_displayLevel=level; }
@@ -140,6 +141,8 @@ void BMK_setBenchSeparately(int separate) { g_benchSeparately = (separate!=0); }
void BMK_setDecodeOnlyMode(int set) { g_decodeOnly = (set!=0); }
+void BMK_skipChecksums(int skip) { g_skipChecksums = (skip!=0); }
+
/* *************************************
* Compression state management
@@ -318,10 +321,11 @@ LZ4F_decompress_binding(const char* src, char* dst,
{
size_t dstSize = (size_t)dstCapacity;
size_t readSize = (size_t)srcSize;
+ LZ4F_decompressOptions_t const dOpt = { 1, g_skipChecksums, 0, 0 };
size_t const decStatus = LZ4F_decompress(g_dctx,
dst, &dstSize,
src, &readSize,
- NULL /* dOptPtr */);
+ &dOpt);
if ( (decStatus == 0) /* decompression successful */
&& ((int)readSize==srcSize) /* consume all input */ )
return (int)dstSize;
@@ -775,7 +779,12 @@ int BMK_benchFiles(const char** fileNamesTable, unsigned nbFiles,
if (cLevel > LZ4HC_CLEVEL_MAX) cLevel = LZ4HC_CLEVEL_MAX;
if (g_decodeOnly) {
- DISPLAYLEVEL(2, "Benchmark Decompression (only) of LZ4 Frame \n");
+ DISPLAYLEVEL(2, "Benchmark Decompression of LZ4 Frame ");
+ if (g_skipChecksums) {
+ DISPLAYLEVEL(2, "_without_ checksum even when present \n");
+ } else {
+ DISPLAYLEVEL(2, "+ Checksum when present \n");
+ }
cLevelLast = cLevel;
}
if (cLevelLast > LZ4HC_CLEVEL_MAX) cLevelLast = LZ4HC_CLEVEL_MAX;