added several compilation flags
This commit is contained in:
parent
bd1964a988
commit
83d0c764dc
@ -24,7 +24,9 @@ CPPFLAGS+= -I. -I./common -DXXH_NAMESPACE=ZSTD_
|
|||||||
CFLAGS ?= -O3
|
CFLAGS ?= -O3
|
||||||
DEBUGFLAGS = -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
|
DEBUGFLAGS = -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
|
||||||
-Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
|
-Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
|
||||||
-Wstrict-prototypes -Wundef -Wpointer-arith -Wformat-security
|
-Wstrict-prototypes -Wundef -Wpointer-arith -Wformat-security \
|
||||||
|
-Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \
|
||||||
|
-Wbad-function-cast -Wredundant-decls
|
||||||
CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS)
|
CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS)
|
||||||
FLAGS = $(CPPFLAGS) $(CFLAGS)
|
FLAGS = $(CPPFLAGS) $(CFLAGS)
|
||||||
|
|
||||||
|
@ -43,7 +43,9 @@ CPPFLAGS+= -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \
|
|||||||
CFLAGS ?= -O3
|
CFLAGS ?= -O3
|
||||||
DEBUGFLAGS = -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
|
DEBUGFLAGS = -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
|
||||||
-Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
|
-Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
|
||||||
-Wstrict-prototypes -Wundef -Wpointer-arith -Wformat-security
|
-Wstrict-prototypes -Wundef -Wpointer-arith -Wformat-security \
|
||||||
|
-Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \
|
||||||
|
-Wbad-function-cast -Wredundant-decls
|
||||||
CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS)
|
CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS)
|
||||||
FLAGS = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
|
FLAGS = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
|
||||||
|
|
||||||
|
@ -33,7 +33,9 @@ CPPFLAGS+= -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \
|
|||||||
CFLAGS ?= -O3
|
CFLAGS ?= -O3
|
||||||
CFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
|
CFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
|
||||||
-Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
|
-Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
|
||||||
-Wstrict-prototypes -Wundef -Wformat-security
|
-Wstrict-prototypes -Wundef -Wformat-security \
|
||||||
|
-Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \
|
||||||
|
-Wbad-function-cast -Wredundant-decls
|
||||||
CFLAGS += $(MOREFLAGS)
|
CFLAGS += $(MOREFLAGS)
|
||||||
FLAGS = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
|
FLAGS = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
|
||||||
|
|
||||||
|
@ -48,7 +48,8 @@ static int usage(const char* programName)
|
|||||||
DISPLAY( "Arguments :\n");
|
DISPLAY( "Arguments :\n");
|
||||||
DISPLAY( " -g# : generate # data (default:%i)\n", SIZE_DEFAULT);
|
DISPLAY( " -g# : generate # data (default:%i)\n", SIZE_DEFAULT);
|
||||||
DISPLAY( " -s# : Select seed (default:%i)\n", SEED_DEFAULT);
|
DISPLAY( " -s# : Select seed (default:%i)\n", SEED_DEFAULT);
|
||||||
DISPLAY( " -P# : Select compressibility in %% (default:%i%%)\n", COMPRESSIBILITY_DEFAULT);
|
DISPLAY( " -P# : Select compressibility in %% (default:%i%%)\n",
|
||||||
|
COMPRESSIBILITY_DEFAULT);
|
||||||
DISPLAY( " -h : display help and exit\n");
|
DISPLAY( " -h : display help and exit\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -56,7 +57,7 @@ static int usage(const char* programName)
|
|||||||
|
|
||||||
int main(int argc, const char** argv)
|
int main(int argc, const char** argv)
|
||||||
{
|
{
|
||||||
double proba = (double)COMPRESSIBILITY_DEFAULT / 100;
|
unsigned probaU32 = COMPRESSIBILITY_DEFAULT;
|
||||||
double litProba = 0.0;
|
double litProba = 0.0;
|
||||||
U64 size = SIZE_DEFAULT;
|
U64 size = SIZE_DEFAULT;
|
||||||
U32 seed = SEED_DEFAULT;
|
U32 seed = SEED_DEFAULT;
|
||||||
@ -94,11 +95,10 @@ int main(int argc, const char** argv)
|
|||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
argument++;
|
argument++;
|
||||||
proba=0.0;
|
probaU32=0.0;
|
||||||
while ((*argument>='0') && (*argument<='9'))
|
while ((*argument>='0') && (*argument<='9'))
|
||||||
proba *= 10, proba += *argument++ - '0';
|
probaU32 *= 10, probaU32 += *argument++ - '0';
|
||||||
if (proba>100.) proba=100.;
|
if (probaU32>100.) probaU32=100.;
|
||||||
proba /= 100.;
|
|
||||||
break;
|
break;
|
||||||
case 'L': /* hidden argument : Literal distribution probability */
|
case 'L': /* hidden argument : Literal distribution probability */
|
||||||
argument++;
|
argument++;
|
||||||
@ -117,11 +117,12 @@ int main(int argc, const char** argv)
|
|||||||
}
|
}
|
||||||
} } } /* for(argNb=1; argNb<argc; argNb++) */
|
} } } /* for(argNb=1; argNb<argc; argNb++) */
|
||||||
|
|
||||||
DISPLAYLEVEL(4, "Data Generator \n");
|
DISPLAYLEVEL(4, "Compressible data Generator \n");
|
||||||
|
if (probaU32!=COMPRESSIBILITY_DEFAULT)
|
||||||
|
DISPLAYLEVEL(3, "Compressibility : %i%%\n", probaU32);
|
||||||
DISPLAYLEVEL(3, "Seed = %u \n", seed);
|
DISPLAYLEVEL(3, "Seed = %u \n", seed);
|
||||||
if (proba!=COMPRESSIBILITY_DEFAULT) DISPLAYLEVEL(3, "Compressibility : %i%%\n", (U32)(proba*100));
|
|
||||||
|
|
||||||
RDG_genStdout(size, proba, litProba, seed);
|
RDG_genStdout(size, (double)probaU32/100, litProba, seed);
|
||||||
DISPLAYLEVEL(1, "\n");
|
DISPLAYLEVEL(1, "\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -363,9 +363,8 @@ static size_t benchMem(const void* src, size_t srcSize, U32 benchNb)
|
|||||||
for (loopNb = 1; loopNb <= g_nbIterations; loopNb++) {
|
for (loopNb = 1; loopNb <= g_nbIterations; loopNb++) {
|
||||||
clock_t const timeLoop = TIMELOOP_S * CLOCKS_PER_SEC;
|
clock_t const timeLoop = TIMELOOP_S * CLOCKS_PER_SEC;
|
||||||
clock_t clockStart;
|
clock_t clockStart;
|
||||||
U32 nbRounds;
|
|
||||||
size_t benchResult=0;
|
size_t benchResult=0;
|
||||||
double averageTime;
|
U32 nbRounds;
|
||||||
|
|
||||||
clockStart = clock();
|
clockStart = clock();
|
||||||
while (clock() == clockStart);
|
while (clock() == clockStart);
|
||||||
@ -374,10 +373,11 @@ static size_t benchMem(const void* src, size_t srcSize, U32 benchNb)
|
|||||||
benchResult = benchFunction(dstBuff, dstBuffSize, buff2, src, srcSize);
|
benchResult = benchFunction(dstBuff, dstBuffSize, buff2, src, srcSize);
|
||||||
if (ZSTD_isError(benchResult)) { DISPLAY("ERROR ! %s() => %s !! \n", benchName, ZSTD_getErrorName(benchResult)); exit(1); }
|
if (ZSTD_isError(benchResult)) { DISPLAY("ERROR ! %s() => %s !! \n", benchName, ZSTD_getErrorName(benchResult)); exit(1); }
|
||||||
}
|
}
|
||||||
averageTime = (((double)BMK_clockSpan(clockStart)) / CLOCKS_PER_SEC) / nbRounds;
|
{ clock_t const clockTotal = BMK_clockSpan(clockStart);
|
||||||
|
double const averageTime = (double)clockTotal / CLOCKS_PER_SEC / nbRounds;
|
||||||
if (averageTime < bestTime) bestTime = averageTime;
|
if (averageTime < bestTime) bestTime = averageTime;
|
||||||
DISPLAY("%2i- %-30.30s : %7.1f MB/s (%9u)\r", loopNb, benchName, (double)srcSize / (1 MB) / bestTime, (U32)benchResult);
|
DISPLAY("%2i- %-30.30s : %7.1f MB/s (%9u)\r", loopNb, benchName, (double)srcSize / (1 MB) / bestTime, (U32)benchResult);
|
||||||
} }
|
} } }
|
||||||
DISPLAY("%2u\n", benchNb);
|
DISPLAY("%2u\n", benchNb);
|
||||||
|
|
||||||
_cleanOut:
|
_cleanOut:
|
||||||
|
@ -47,7 +47,7 @@ static const size_t maxMemory = (sizeof(size_t)==4) ? (2 GB - 64 MB) : (size_t
|
|||||||
#define COMPRESSIBILITY_DEFAULT 0.50
|
#define COMPRESSIBILITY_DEFAULT 0.50
|
||||||
static const size_t sampleSize = 10000000;
|
static const size_t sampleSize = 10000000;
|
||||||
|
|
||||||
static const U32 g_grillDuration_s = 60000; /* about 16 hours */
|
static const double g_grillDuration_s = 90000; /* about 24 hours */
|
||||||
static const clock_t g_maxParamTime = 15 * CLOCKS_PER_SEC;
|
static const clock_t g_maxParamTime = 15 * CLOCKS_PER_SEC;
|
||||||
static const clock_t g_maxVariationTime = 60 * CLOCKS_PER_SEC;
|
static const clock_t g_maxVariationTime = 60 * CLOCKS_PER_SEC;
|
||||||
static const int g_maxNbVariations = 64;
|
static const int g_maxNbVariations = 64;
|
||||||
@ -87,9 +87,11 @@ void BMK_SetNbIterations(int nbLoops)
|
|||||||
* Private functions
|
* Private functions
|
||||||
*********************************************************/
|
*********************************************************/
|
||||||
|
|
||||||
static clock_t BMK_clockSpan(clock_t cStart) { return clock() - cStart; } /* works even if overflow ; max span ~ 30 mn */
|
/* works even if overflow ; max span ~ 30 mn */
|
||||||
|
static clock_t BMK_clockSpan(clock_t cStart) { return clock() - cStart; }
|
||||||
|
|
||||||
static U32 BMK_timeSpan(time_t tStart) { return (U32)difftime(time(NULL), tStart); } /* accuracy in seconds only, span can be multiple years */
|
/* accuracy in seconds only, span can be multiple years */
|
||||||
|
static double BMK_timeSpan(time_t tStart) { return difftime(time(NULL), tStart); }
|
||||||
|
|
||||||
|
|
||||||
static size_t BMK_findMaxMem(U64 requiredMem)
|
static size_t BMK_findMaxMem(U64 requiredMem)
|
||||||
|
Loading…
Reference in New Issue
Block a user