bench: introduced hidden command -S
to benchmark multiple files with separate results
This commit is contained in:
parent
5b67c7d185
commit
1faa7e2698
@ -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;
|
||||
}
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user