diff options
Diffstat (limited to 'examples/streaming_compression_thread_pool.c')
-rw-r--r-- | examples/streaming_compression_thread_pool.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/examples/streaming_compression_thread_pool.c b/examples/streaming_compression_thread_pool.c index 22c3b2efacc9..21cb3d54999f 100644 --- a/examples/streaming_compression_thread_pool.c +++ b/examples/streaming_compression_thread_pool.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Martin Liska, SUSE, Facebook, Inc. + * Copyright (c) Martin Liska, SUSE, Facebook, Inc. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -28,8 +28,10 @@ typedef struct compress_args static void *compressFile_orDie(void *data) { + const int nbThreads = 16; + compress_args_t *args = (compress_args_t *)data; - fprintf (stderr, "Starting compression of %s with level %d\n", args->fname, args->cLevel); + fprintf (stderr, "Starting compression of %s with level %d, using %d threads\n", args->fname, args->cLevel, nbThreads); /* Open the input and output files. */ FILE* const fin = fopen_orDie(args->fname, "rb"); FILE* const fout = fopen_orDie(args->outName, "wb"); @@ -56,9 +58,9 @@ static void *compressFile_orDie(void *data) */ CHECK_ZSTD( ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, args->cLevel) ); CHECK_ZSTD( ZSTD_CCtx_setParameter(cctx, ZSTD_c_checksumFlag, 1) ); - ZSTD_CCtx_setParameter(cctx, ZSTD_c_nbWorkers, 16); + ZSTD_CCtx_setParameter(cctx, ZSTD_c_nbWorkers, nbThreads); - /* This loop read from the input file, compresses that entire chunk, + /* This loop reads from the input file, compresses that entire chunk, * and writes all output produced to the output file. */ size_t const toRead = buffInSize; |