Home | History | Annotate | Download | only in compress

Lines Matching refs:nbWorkers

278 #define BUF_POOL_MAX_NB_BUFFERS(nbWorkers) (2*(nbWorkers) + 3)
282 #define SEQ_POOL_MAX_NB_BUFFERS(nbWorkers) (nbWorkers)
334 static ZSTDMT_seqPool* ZSTDMT_createSeqPool(unsigned nbWorkers, ZSTD_customMem cMem)
336 ZSTDMT_seqPool* const seqPool = ZSTDMT_createBufferPool(SEQ_POOL_MAX_NB_BUFFERS(nbWorkers), cMem);
347 static ZSTDMT_seqPool* ZSTDMT_expandSeqPool(ZSTDMT_seqPool* pool, U32 nbWorkers)
349 return ZSTDMT_expandBufferPool(pool, SEQ_POOL_MAX_NB_BUFFERS(nbWorkers));
379 * implies nbWorkers >= 1 , checked by caller ZSTDMT_createCCtx() */
380 static ZSTDMT_CCtxPool* ZSTDMT_createCCtxPool(int nbWorkers,
385 assert(nbWorkers > 0);
391 cctxPool->totalCCtx = nbWorkers;
392 cctxPool->cctxs = (ZSTD_CCtx**)ZSTD_customCalloc(nbWorkers * sizeof(ZSTD_CCtx*), cMem);
401 DEBUGLOG(3, "cctxPool created, with %u workers", nbWorkers);
406 int nbWorkers)
409 if (nbWorkers <= srcPool->totalCCtx) return srcPool; /* good enough */
413 return ZSTDMT_createCCtxPool(nbWorkers, cMem);
421 { unsigned const nbWorkers = cctxPool->totalCCtx;
426 for (u=0; u<nbWorkers; u++) {
430 assert(nbWorkers > 0);
457 /* pool overflow : should not happen, since totalCCtx==nbWorkers */
719 /* Correct nbWorkers to 0. */
720 jobParams.nbWorkers = 0;
929 static size_t ZSTDMT_expandJobsTable (ZSTDMT_CCtx* mtctx, U32 nbWorkers) {
930 U32 nbJobs = nbWorkers + 2;
945 static size_t ZSTDMT_CCtxParam_setNbWorkers(ZSTD_CCtx_params* params, unsigned nbWorkers)
947 return ZSTD_CCtxParams_setParameter(params, ZSTD_c_nbWorkers, (int)nbWorkers);
950 MEM_STATIC ZSTDMT_CCtx* ZSTDMT_createCCtx_advanced_internal(unsigned nbWorkers, ZSTD_customMem cMem, ZSTD_threadPool* pool)
953 U32 nbJobs = nbWorkers + 2;
955 DEBUGLOG(3, "ZSTDMT_createCCtx_advanced (nbWorkers = %u)", nbWorkers);
957 if (nbWorkers < 1) return NULL;
958 nbWorkers = MIN(nbWorkers , ZSTDMT_NBWORKERS_MAX);
965 ZSTDMT_CCtxParam_setNbWorkers(&mtctx->params, nbWorkers);
973 mtctx->factory = POOL_create_advanced(nbWorkers, 0, cMem);
979 mtctx->bufPool = ZSTDMT_createBufferPool(BUF_POOL_MAX_NB_BUFFERS(nbWorkers), cMem);
980 mtctx->cctxPool = ZSTDMT_createCCtxPool(nbWorkers, cMem);
981 mtctx->seqPool = ZSTDMT_createSeqPool(nbWorkers, cMem);
988 DEBUGLOG(3, "mt_cctx created, for %u threads", nbWorkers);
992 ZSTDMT_CCtx* ZSTDMT_createCCtx_advanced(unsigned nbWorkers, ZSTD_customMem cMem, ZSTD_threadPool* pool)
995 return ZSTDMT_createCCtx_advanced_internal(nbWorkers, cMem, pool);
997 (void)nbWorkers;
1078 static size_t ZSTDMT_resize(ZSTDMT_CCtx* mtctx, unsigned nbWorkers)
1080 if (POOL_resize(mtctx->factory, nbWorkers)) return ERROR(memory_allocation);
1081 FORWARD_IF_ERROR( ZSTDMT_expandJobsTable(mtctx, nbWorkers) , "");
1082 mtctx->bufPool = ZSTDMT_expandBufferPool(mtctx->bufPool, BUF_POOL_MAX_NB_BUFFERS(nbWorkers));
1084 mtctx->cctxPool = ZSTDMT_expandCCtxPool(mtctx->cctxPool, nbWorkers);
1086 mtctx->seqPool = ZSTDMT_expandSeqPool(mtctx->seqPool, nbWorkers);
1088 ZSTDMT_CCtxParam_setNbWorkers(&mtctx->params, nbWorkers);
1255 DEBUGLOG(4, "ZSTDMT_initCStream_internal (pledgedSrcSize=%u, nbWorkers=%u, cctxPool=%u)",
1256 (U32)pledgedSrcSize, params.nbWorkers, mtctx->cctxPool->totalCCtx);
1263 if (params.nbWorkers != mtctx->params.nbWorkers)
1264 FORWARD_IF_ERROR( ZSTDMT_resize(mtctx, (unsigned)params.nbWorkers) , "");
1325 size_t const nbWorkers = MAX(mtctx->params.nbWorkers, 1);
1326 size_t const sectionsSize = mtctx->targetSectionSize * nbWorkers;