static size_t g_blockSize = 0;
static int g_additionalParam = 0;
static U32 g_decodeOnly = 0;
+static U32 g_nbThreads = 1;
void BMK_setNotificationLevel(unsigned level) { g_displayLevel=level; }
DISPLAYLEVEL(2, "using blocks of size %u KB \n", (U32)(blockSize>>10));
}
-void BMK_setDecodeOnly(unsigned decodeFlag) { g_decodeOnly = (decodeFlag>0); }
+void BMK_setDecodeOnlyMode(unsigned decodeFlag) { g_decodeOnly = (decodeFlag>0); }
+
+void BMK_SetNbThreads(unsigned nbThreads) { g_nbThreads = nbThreads; }
/* ********************************************************
U32 nbBlocks;
UTIL_time_t ticksPerSecond;
- ZSTDMT_CCtx* const mtcctx = ZSTDMT_createCCtx(1);
+ ZSTDMT_CCtx* const mtcctx = ZSTDMT_createCCtx(g_nbThreads);
/* checks */
if (!compressedBuffer || !resultBuffer || !blockTable || !ctx || !dctx)
#define ZSTD_STATIC_LINKING_ONLY /* ZSTD_compressionParameters */
#include "zstd.h" /* ZSTD_compressionParameters */
-int BMK_benchFiles(const char** fileNamesTable, unsigned nbFiles,const char* dictFileName,
+int BMK_benchFiles(const char** fileNamesTable, unsigned nbFiles,const char* dictFileName,
int cLevel, int cLevelLast, ZSTD_compressionParameters* compressionParams);
/* Set Parameters */
void BMK_SetNbSeconds(unsigned nbLoops);
void BMK_SetBlockSize(size_t blockSize);
-void BMK_setAdditionalParam(int additionalParam);
+void BMK_SetNbThreads(unsigned nbThreads);
void BMK_setNotificationLevel(unsigned level);
-void BMK_setDecodeOnly(unsigned decodeFlag);
+void BMK_setAdditionalParam(int additionalParam);
+void BMK_setDecodeOnlyMode(unsigned decodeFlag);
#endif /* BENCH_H_121279284357 */
/* Decoding */
case 'd':
#ifndef ZSTD_NOBENCH
- if (operation==zom_bench) { BMK_setDecodeOnly(1); argument++; break; } /* benchmark decode (hidden option) */
+ if (operation==zom_bench) { BMK_setDecodeOnlyMode(1); argument++; break; } /* benchmark decode (hidden option) */
#endif
operation=zom_decompress; argument++; break;
dictSelect = readU32FromChar(&argument);
break;
+ /* nb of threads (hidden option) */
+ case 'T':
+ argument++;
+ BMK_SetNbThreads(readU32FromChar(&argument));
+ break;
+
/* Pause at the end (-p) or set an additional param (-p#) (hidden option) */
case 'p': argument++;
#ifndef ZSTD_NOBENCH