summaryrefslogtreecommitdiffstats
path: root/programs
diff options
context:
space:
mode:
Diffstat (limited to 'programs')
-rw-r--r--programs/bench.c34
-rw-r--r--programs/bench.h5
-rw-r--r--programs/lz4cli.c10
3 files changed, 37 insertions, 12 deletions
diff --git a/programs/bench.c b/programs/bench.c
index 002eac9..770191c 100644
--- a/programs/bench.c
+++ b/programs/bench.c
@@ -119,21 +119,21 @@ static clock_t g_time = 0;
static U32 g_nbSeconds = NBSECONDS;
static size_t g_blockSize = 0;
int g_additionalParam = 0;
+int g_benchSeparately = 0;
void BMK_setNotificationLevel(unsigned level) { g_displayLevel=level; }
void BMK_setAdditionalParam(int additionalParam) { g_additionalParam=additionalParam; }
-void BMK_SetNbSeconds(unsigned nbSeconds)
+void BMK_setNbSeconds(unsigned nbSeconds)
{
g_nbSeconds = nbSeconds;
DISPLAYLEVEL(3, "- test >= %u seconds per compression / decompression -\n", g_nbSeconds);
}
-void BMK_SetBlockSize(size_t blockSize)
-{
- g_blockSize = blockSize;
-}
+void BMK_setBlockSize(size_t blockSize) { g_blockSize = blockSize; }
+
+void BMK_setBenchSeparately(int separate) { g_benchSeparately = (separate!=0); }
/* ********************************************************
@@ -515,6 +515,22 @@ static void BMK_syntheticTest(int cLevel, int cLevelLast, double compressibility
}
+int BMK_benchFilesSeparately(const char** fileNamesTable, unsigned nbFiles,
+ int cLevel, int cLevelLast)
+{
+ unsigned fileNb;
+ if (cLevel > LZ4HC_CLEVEL_MAX) cLevel = LZ4HC_CLEVEL_MAX;
+ if (cLevelLast > LZ4HC_CLEVEL_MAX) cLevelLast = LZ4HC_CLEVEL_MAX;
+ if (cLevelLast < cLevel) cLevelLast = cLevel;
+ if (cLevelLast > cLevel) DISPLAYLEVEL(2, "Benchmarking levels from %d to %d\n", cLevel, cLevelLast);
+
+ for (fileNb=0; fileNb<nbFiles; fileNb++)
+ BMK_benchFileTable(fileNamesTable+fileNb, 1, cLevel, cLevelLast);
+
+ return 0;
+}
+
+
int BMK_benchFiles(const char** fileNamesTable, unsigned nbFiles,
int cLevel, int cLevelLast)
{
@@ -527,7 +543,11 @@ int BMK_benchFiles(const char** fileNamesTable, unsigned nbFiles,
if (nbFiles == 0)
BMK_syntheticTest(cLevel, cLevelLast, compressibility);
- else
- BMK_benchFileTable(fileNamesTable, nbFiles, cLevel, cLevelLast);
+ else {
+ if (g_benchSeparately)
+ BMK_benchFilesSeparately(fileNamesTable, nbFiles, cLevel, cLevelLast);
+ else
+ BMK_benchFileTable(fileNamesTable, nbFiles, cLevel, cLevelLast);
+ }
return 0;
}
diff --git a/programs/bench.h b/programs/bench.h
index 15def93..bb67bee 100644
--- a/programs/bench.h
+++ b/programs/bench.h
@@ -29,9 +29,10 @@ int BMK_benchFiles(const char** fileNamesTable, unsigned nbFiles,
int cLevel, int cLevelLast);
/* Set Parameters */
-void BMK_SetNbSeconds(unsigned nbLoops);
-void BMK_SetBlockSize(size_t blockSize);
+void BMK_setNbSeconds(unsigned nbLoops);
+void BMK_setBlockSize(size_t blockSize);
void BMK_setAdditionalParam(int additionalParam);
void BMK_setNotificationLevel(unsigned level);
+void BMK_setBenchSeparately(int separate);
#endif /* BENCH_H_125623623633 */
diff --git a/programs/lz4cli.c b/programs/lz4cli.c
index 362ba49..42392eb 100644
--- a/programs/lz4cli.c
+++ b/programs/lz4cli.c
@@ -458,11 +458,11 @@ int main(int argc, const char** argv)
if (B < 4) badusage(exeName);
if (B <= 7) {
blockSize = LZ4IO_setBlockSizeID(B);
- BMK_SetBlockSize(blockSize);
+ BMK_setBlockSize(blockSize);
DISPLAYLEVEL(2, "using blocks of size %u KB \n", (U32)(blockSize>>10));
} else {
if (B < 32) badusage(exeName);
- BMK_SetBlockSize(B);
+ BMK_setBlockSize(B);
if (B >= 1024) {
DISPLAYLEVEL(2, "bench: using blocks of size %u KB \n", (U32)(B>>10));
} else {
@@ -480,6 +480,10 @@ int main(int argc, const char** argv)
case 'b': mode = om_bench; multiple_inputs=1;
break;
+ /* hidden command : benchmark files, but do not fuse result */
+ case 'S': BMK_setBenchSeparately(1);
+ break;
+
#ifdef UTIL_HAS_CREATEFILELIST
/* recursive */
case 'r': recursive=1;
@@ -496,7 +500,7 @@ int main(int argc, const char** argv)
iters = readU32FromChar(&argument);
argument--;
BMK_setNotificationLevel(displayLevel);
- BMK_SetNbSeconds(iters); /* notification if displayLevel >= 3 */
+ BMK_setNbSeconds(iters); /* notification if displayLevel >= 3 */
}
break;