Merge pull request #4620 from jlee303/defineable_cflags
Make DISPLAY_LEVEL_DEFAULT configurable at compile time
This commit is contained in:
@@ -45,7 +45,9 @@
|
|||||||
#define RUN_TIME_DEFAULT_MS 1000
|
#define RUN_TIME_DEFAULT_MS 1000
|
||||||
#define BENCH_TIME_DEFAULT_MS (BENCH_TIME_DEFAULT_S * RUN_TIME_DEFAULT_MS)
|
#define BENCH_TIME_DEFAULT_MS (BENCH_TIME_DEFAULT_S * RUN_TIME_DEFAULT_MS)
|
||||||
|
|
||||||
#define DISPLAY_LEVEL_DEFAULT 3
|
#ifndef ZSTD_DISPLAY_LEVEL_DEFAULT
|
||||||
|
# define ZSTD_DISPLAY_LEVEL_DEFAULT 3
|
||||||
|
#endif
|
||||||
|
|
||||||
#define BENCH_SIZE_MAX (1200 MB)
|
#define BENCH_SIZE_MAX (1200 MB)
|
||||||
|
|
||||||
@@ -61,7 +63,7 @@
|
|||||||
|
|
||||||
#define DISPLAY(...) fprintf(stdout, __VA_ARGS__)
|
#define DISPLAY(...) fprintf(stdout, __VA_ARGS__)
|
||||||
#define DISPLAYLEVEL(l, ...) { if (g_displayLevel>=l) { DISPLAY(__VA_ARGS__); } }
|
#define DISPLAYLEVEL(l, ...) { if (g_displayLevel>=l) { DISPLAY(__VA_ARGS__); } }
|
||||||
static int g_displayLevel = DISPLAY_LEVEL_DEFAULT; /* 0 : no display, 1: errors, 2 : + result + interaction + warnings, 3 : + progression, 4 : + information */
|
static int g_displayLevel = ZSTD_DISPLAY_LEVEL_DEFAULT; /* 0 : no display, 1: errors, 2 : + result + interaction + warnings, 3 : + progression, 4 : + information */
|
||||||
|
|
||||||
|
|
||||||
/*--- buffer_t ---*/
|
/*--- buffer_t ---*/
|
||||||
|
|||||||
@@ -79,6 +79,13 @@ There are however other Makefile targets that create different variations of CLI
|
|||||||
This can be useful to produce smaller binaries.
|
This can be useful to produce smaller binaries.
|
||||||
A corresponding `Makefile` target using this ability is `zstd-compress`.
|
A corresponding `Makefile` target using this ability is `zstd-compress`.
|
||||||
|
|
||||||
|
- __ZSTD_DISPLAY_LEVEL_DEFAULT__ : Controls the default verbosity level of `zstd` output.
|
||||||
|
The default value is `2`. Lower values (e.g., `1`) reduce output verbosity,
|
||||||
|
while higher values (e.g., `3`) increase it.
|
||||||
|
This allows setting preferred verbosity at compile time,
|
||||||
|
rather than passing `-q` or `-v` flags at runtime.
|
||||||
|
Example : `CPPFLAGS="-DZSTD_DISPLAY_LEVEL_DEFAULT=1" make`
|
||||||
|
|
||||||
- __BACKTRACE__ : `zstd` can display a stack backtrace when execution
|
- __BACKTRACE__ : `zstd` can display a stack backtrace when execution
|
||||||
generates a runtime exception. By default, this feature may be
|
generates a runtime exception. By default, this feature may be
|
||||||
degraded/disabled on some platforms unless additional compiler directives are
|
degraded/disabled on some platforms unless additional compiler directives are
|
||||||
|
|||||||
+3
-1
@@ -2401,7 +2401,9 @@ int FIO_compressFilename(FIO_ctx_t* const fCtx, FIO_prefs_t* const prefs, const
|
|||||||
cRess_t ress = FIO_createCResources(prefs, dictFileName, UTIL_getFileSize(srcFileName), compressionLevel, comprParams);
|
cRess_t ress = FIO_createCResources(prefs, dictFileName, UTIL_getFileSize(srcFileName), compressionLevel, comprParams);
|
||||||
int const result = FIO_compressFilename_srcFile(fCtx, prefs, &ress, dstFileName, srcFileName, compressionLevel);
|
int const result = FIO_compressFilename_srcFile(fCtx, prefs, &ress, dstFileName, srcFileName, compressionLevel);
|
||||||
|
|
||||||
#define DISPLAY_LEVEL_DEFAULT 2
|
#ifndef ZSTD_DISPLAY_LEVEL_DEFAULT
|
||||||
|
# define ZSTD_DISPLAY_LEVEL_DEFAULT 2
|
||||||
|
#endif
|
||||||
|
|
||||||
FIO_freeCResources(&ress);
|
FIO_freeCResources(&ress);
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
+5
-3
@@ -77,7 +77,9 @@ static unsigned init_nbWorkers(unsigned defaultNbWorkers);
|
|||||||
#define MB *(1 <<20)
|
#define MB *(1 <<20)
|
||||||
#define GB *(1U<<30)
|
#define GB *(1U<<30)
|
||||||
|
|
||||||
#define DISPLAY_LEVEL_DEFAULT 2
|
#ifndef ZSTD_DISPLAY_LEVEL_DEFAULT
|
||||||
|
# define ZSTD_DISPLAY_LEVEL_DEFAULT 2
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char* g_defaultDictName = "dictionary";
|
static const char* g_defaultDictName = "dictionary";
|
||||||
static const unsigned g_defaultMaxDictSize = 110 KB;
|
static const unsigned g_defaultMaxDictSize = 110 KB;
|
||||||
@@ -104,7 +106,7 @@ typedef enum { cover, fastCover, legacy } dictType;
|
|||||||
**************************************/
|
**************************************/
|
||||||
#undef DISPLAYLEVEL
|
#undef DISPLAYLEVEL
|
||||||
#define DISPLAYLEVEL(l, ...) { if (g_displayLevel>=l) { DISPLAY(__VA_ARGS__); } }
|
#define DISPLAYLEVEL(l, ...) { if (g_displayLevel>=l) { DISPLAY(__VA_ARGS__); } }
|
||||||
static int g_displayLevel = DISPLAY_LEVEL_DEFAULT; /* 0 : no display, 1: errors, 2 : + result + interaction + warnings, 3 : + progression, 4 : + information */
|
static int g_displayLevel = ZSTD_DISPLAY_LEVEL_DEFAULT; /* 0 : no display, 1: errors, 2 : + result + interaction + warnings, 3 : + progression, 4 : + information */
|
||||||
|
|
||||||
|
|
||||||
/*-************************************
|
/*-************************************
|
||||||
@@ -674,7 +676,7 @@ static void setMaxCompression(ZSTD_compressionParameters* params)
|
|||||||
|
|
||||||
static void printVersion(void)
|
static void printVersion(void)
|
||||||
{
|
{
|
||||||
if (g_displayLevel < DISPLAY_LEVEL_DEFAULT) {
|
if (g_displayLevel < ZSTD_DISPLAY_LEVEL_DEFAULT) {
|
||||||
DISPLAYOUT("%s\n", ZSTD_VERSION_STRING);
|
DISPLAYOUT("%s\n", ZSTD_VERSION_STRING);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user