added command --block-size=
for Multi-threading only. alias : -B#
This commit is contained in:
+11
-3
@@ -124,6 +124,13 @@ void FIO_setBlockSize(unsigned blockSize) {
|
|||||||
#endif
|
#endif
|
||||||
g_blockSize = blockSize;
|
g_blockSize = blockSize;
|
||||||
}
|
}
|
||||||
|
static const U32 g_overlapLogNotSet = 9999;
|
||||||
|
static U32 g_overlapLog = g_overlapLogNotSet;
|
||||||
|
void FIO_setOverlapLog(unsigned overlapLog){
|
||||||
|
if (overlapLog && g_nbThreads==1)
|
||||||
|
DISPLAYLEVEL(2, "Setting overlapLog is useless in single-thread mode \n");
|
||||||
|
g_overlapLog = overlapLog;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*-*************************************
|
/*-*************************************
|
||||||
@@ -272,8 +279,10 @@ static cRess_t FIO_createCResources(const char* dictFileName, int cLevel,
|
|||||||
#ifdef ZSTD_MULTITHREAD
|
#ifdef ZSTD_MULTITHREAD
|
||||||
ress.cctx = ZSTDMT_createCCtx(g_nbThreads);
|
ress.cctx = ZSTDMT_createCCtx(g_nbThreads);
|
||||||
if (ress.cctx == NULL) EXM_THROW(30, "zstd: allocation error : can't create ZSTD_CStream");
|
if (ress.cctx == NULL) EXM_THROW(30, "zstd: allocation error : can't create ZSTD_CStream");
|
||||||
if (cLevel==ZSTD_maxCLevel())
|
if ((cLevel==ZSTD_maxCLevel()) && (g_overlapLog==g_overlapLogNotSet))
|
||||||
ZSTDMT_setMTCtxParameter(ress.cctx, ZSTDMT_p_overlapSectionRLog, 0); /* use complete window for overlap */
|
ZSTDMT_setMTCtxParameter(ress.cctx, ZSTDMT_p_overlapSectionLog, 0); /* use complete window for overlap */
|
||||||
|
if (g_overlapLog != g_overlapLogNotSet)
|
||||||
|
ZSTDMT_setMTCtxParameter(ress.cctx, ZSTDMT_p_overlapSectionLog, g_overlapLog);
|
||||||
#else
|
#else
|
||||||
ress.cctx = ZSTD_createCStream();
|
ress.cctx = ZSTD_createCStream();
|
||||||
if (ress.cctx == NULL) EXM_THROW(30, "zstd: allocation error : can't create ZSTD_CStream");
|
if (ress.cctx == NULL) EXM_THROW(30, "zstd: allocation error : can't create ZSTD_CStream");
|
||||||
@@ -355,7 +364,6 @@ static int FIO_compressFilename_internal(cRess_t ress,
|
|||||||
size_t const inSize = fread(ress.srcBuffer, (size_t)1, ress.srcBufferSize, srcFile);
|
size_t const inSize = fread(ress.srcBuffer, (size_t)1, ress.srcBufferSize, srcFile);
|
||||||
if (inSize==0) break;
|
if (inSize==0) break;
|
||||||
readsize += inSize;
|
readsize += inSize;
|
||||||
DISPLAYUPDATE(2, "\rRead : %u MB ", (U32)(readsize>>20));
|
|
||||||
|
|
||||||
{ ZSTD_inBuffer inBuff = { ress.srcBuffer, inSize, 0 };
|
{ ZSTD_inBuffer inBuff = { ress.srcBuffer, inSize, 0 };
|
||||||
while (inBuff.pos != inBuff.size) { /* note : is there any possibility of endless loop ? for example, if outBuff is not large enough ? */
|
while (inBuff.pos != inBuff.size) { /* note : is there any possibility of endless loop ? for example, if outBuff is not large enough ? */
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ void FIO_setRemoveSrcFile(unsigned flag);
|
|||||||
void FIO_setMemLimit(unsigned memLimit);
|
void FIO_setMemLimit(unsigned memLimit);
|
||||||
void FIO_setNbThreads(unsigned nbThreads);
|
void FIO_setNbThreads(unsigned nbThreads);
|
||||||
void FIO_setBlockSize(unsigned blockSize);
|
void FIO_setBlockSize(unsigned blockSize);
|
||||||
|
void FIO_setOverlapLog(unsigned overlapLog);
|
||||||
|
|
||||||
|
|
||||||
/*-*************************************
|
/*-*************************************
|
||||||
|
|||||||
@@ -370,6 +370,7 @@ int main(int argCount, const char* argv[])
|
|||||||
if (longCommandWArg(&argument, "--memlimit=")) { memLimit = readU32FromChar(&argument); continue; }
|
if (longCommandWArg(&argument, "--memlimit=")) { memLimit = readU32FromChar(&argument); continue; }
|
||||||
if (longCommandWArg(&argument, "--memory=")) { memLimit = readU32FromChar(&argument); continue; }
|
if (longCommandWArg(&argument, "--memory=")) { memLimit = readU32FromChar(&argument); continue; }
|
||||||
if (longCommandWArg(&argument, "--memlimit-decompress=")) { memLimit = readU32FromChar(&argument); continue; }
|
if (longCommandWArg(&argument, "--memlimit-decompress=")) { memLimit = readU32FromChar(&argument); continue; }
|
||||||
|
if (longCommandWArg(&argument, "--block-size=")) { blockSize = readU32FromChar(&argument); continue; }
|
||||||
if (longCommandWArg(&argument, "--zstd=")) { if (!parseCompressionParameters(argument, &compressionParams)) CLEAN_RETURN(badusage(programName)); continue; }
|
if (longCommandWArg(&argument, "--zstd=")) { if (!parseCompressionParameters(argument, &compressionParams)) CLEAN_RETURN(badusage(programName)); continue; }
|
||||||
/* fall-through, will trigger bad_usage() later on */
|
/* fall-through, will trigger bad_usage() later on */
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user