report nb of threads in verbose mode

This commit is contained in:
Yann Collet 2023-12-29 12:50:43 -08:00
parent 132c2149c8
commit 0dfbe965d6
3 changed files with 11 additions and 3 deletions

View File

@ -684,7 +684,7 @@ int main(int argCount, const char** argv)
DISPLAYLEVEL(4, "PLATFORM_POSIX_VERSION defined: %ldL\n", (long) PLATFORM_POSIX_VERSION);
#endif
#ifdef _FILE_OFFSET_BITS
DISPLAYLEVEL(4, "_FILE_OFFSET_BITS defined: %ldL\n", (long) _FILE_OFFSET_BITS);
DISPLAYLEVEL(5, "_FILE_OFFSET_BITS defined: %ldL\n", (long) _FILE_OFFSET_BITS);
#endif
#ifndef LZ4IO_MULTITHREAD
if (nbWorkers > 1)
@ -825,6 +825,13 @@ int main(int argCount, const char** argv)
} else if (mode == om_list){
operationResult = LZ4IO_displayCompressedFilesInfo(inFileNames, ifnIdx);
} else { /* compression is default action */
#ifdef LZ4IO_MULTITHREAD
if (nbWorkers != 1) {
if (nbWorkers==0)
nbWorkers = (unsigned)LZ4IO_defaultNbWorkers();
DISPLAYLEVEL(3, "Using %u threads for compression \n", nbWorkers);
}
#endif
if (legacy_format) {
DISPLAYLEVEL(3, "! Generating LZ4 Legacy format (deprecated) ! \n");
if(multiple_inputs){

View File

@ -152,7 +152,7 @@ static void LZ4IO_finalTimeDisplay(TIME_t timeStart, clock_t cpuStart, unsigned
/* ****************** Init functions ******************** */
/* ************************************************** */
static int auto_nbWorkers(void)
int LZ4IO_defaultNbWorkers(void)
{
#ifdef LZ4IO_MULTITHREAD
int const nbCores = UTIL_countCores();
@ -209,7 +209,7 @@ LZ4IO_prefs_t* LZ4IO_defaultPreferences(void)
prefs->favorDecSpeed = 0;
prefs->dictionaryFilename = NULL;
prefs->removeSrcFile = 0;
prefs->nbWorkers = auto_nbWorkers();
prefs->nbWorkers = LZ4IO_defaultNbWorkers();
return prefs;
}

View File

@ -76,6 +76,7 @@ int LZ4IO_decompressMultipleFilenames(const char** inFileNamesTable, int ifntSiz
/* ************************************************** */
int LZ4IO_setNbWorkers(LZ4IO_prefs_t* const prefs, int nbWorkers);
int LZ4IO_defaultNbWorkers(void);
int LZ4IO_setDictionaryFilename(LZ4IO_prefs_t* const prefs, const char* dictionaryFilename);