Updated test-fullbench

This commit is contained in:
Yann Collet
2015-02-11 08:34:50 +01:00
parent f96780683b
commit f66d2babf8
3 changed files with 30 additions and 16 deletions
+2 -6
View File
@@ -129,15 +129,11 @@ test-zstd32: zstd32 datagen
test-fullbench: fullbench datagen test-fullbench: fullbench datagen
./fullbench -i1 ./fullbench -i1
./datagen -P0 -g516K > tmp ./fullbench -i1 -P0
./fullbench -i1 tmp
@rm tmp
test-fullbench32: fullbench32 datagen test-fullbench32: fullbench32 datagen
./fullbench32 -i1 ./fullbench32 -i1
./datagen -P0 -g516K > tmp ./fullbench32 -i1 -P0
./fullbench32 -i1 tmp
@rm tmp
test-fuzzer: fuzzer test-fuzzer: fuzzer
./fuzzer ./fuzzer
+3
View File
@@ -172,6 +172,7 @@ void RDG_genBuffer(void* buffer, size_t size, double matchProba, double litProba
if (litProba==0.0) litProba = matchProba / 3.8; if (litProba==0.0) litProba = matchProba / 3.8;
ldctx = RDG_createLiteralDistrib(litProba); ldctx = RDG_createLiteralDistrib(litProba);
RDG_genBlock(buffer, size, 0, matchProba, ldctx, &seed); RDG_genBlock(buffer, size, 0, matchProba, ldctx, &seed);
free(ldctx);
} }
@@ -203,4 +204,6 @@ void RDG_genOut(unsigned long long size, double matchProba, double litProba, uns
/* update dict */ /* update dict */
memcpy(fullbuff, buff + (RDG_BLOCKSIZE - RDG_DICTSIZE), RDG_DICTSIZE); memcpy(fullbuff, buff + (RDG_BLOCKSIZE - RDG_DICTSIZE), RDG_DICTSIZE);
} }
free(ldctx);
} }
+25 -10
View File
@@ -114,7 +114,7 @@
#define MAX_MEM (1984 MB) #define MAX_MEM (1984 MB)
#define DEFAULT_CHUNKSIZE (4<<20) #define DEFAULT_CHUNKSIZE (4<<20)
static double g_compressibilityDefault = 0.50; #define COMPRESSIBILITY_DEFAULT 0.50
static const size_t sampleSize = 10000000; static const size_t sampleSize = 10000000;
@@ -128,6 +128,7 @@ static const size_t sampleSize = 10000000;
* Benchmark Parameters * Benchmark Parameters
**************************************/ **************************************/
static int nbIterations = NBLOOPS; static int nbIterations = NBLOOPS;
static double g_compressibility = COMPRESSIBILITY_DEFAULT;
void BMK_SetNbIterations(int nbLoops) void BMK_SetNbIterations(int nbLoops)
{ {
@@ -449,7 +450,7 @@ int benchSample(U32 benchNb)
{ {
char* origBuff; char* origBuff;
size_t benchedSize = sampleSize; size_t benchedSize = sampleSize;
const char* name = "Sample50"; const char* name = "Sample 10MiB";
/* Allocation */ /* Allocation */
origBuff = (char*) malloc((size_t)benchedSize); origBuff = (char*) malloc((size_t)benchedSize);
@@ -460,8 +461,7 @@ int benchSample(U32 benchNb)
} }
/* Fill buffer */ /* Fill buffer */
//BMK_datagen(origBuff, benchedSize, g_compressibilityDefault, 0); RDG_genBuffer(origBuff, benchedSize, g_compressibility, 0.0, 0);
RDG_genBuffer(origBuff, benchedSize, g_compressibilityDefault, 0.0, 0);
/* bench */ /* bench */
DISPLAY("\r%79s\r", ""); DISPLAY("\r%79s\r", "");
@@ -556,6 +556,7 @@ int usage_advanced(void)
DISPLAY( "\nAdvanced options :\n"); DISPLAY( "\nAdvanced options :\n");
DISPLAY( " -b# : test only function # \n"); DISPLAY( " -b# : test only function # \n");
DISPLAY( " -i# : iteration loops [1-9](default : %i)\n", NBLOOPS); DISPLAY( " -i# : iteration loops [1-9](default : %i)\n", NBLOOPS);
DISPLAY( " -P# : sample compressibility (default : %.1f%%)\n", COMPRESSIBILITY_DEFAULT * 100);
return 0; return 0;
} }
@@ -595,14 +596,14 @@ int main(int argc, char** argv)
switch(argument[0]) switch(argument[0])
{ {
// Display help on usage /* Display help on usage */
case 'h' : case 'h' :
case 'H': usage(exename); usage_advanced(); return 0; case 'H': usage(exename); usage_advanced(); return 0;
// Pause at the end (hidden option) /* Pause at the end (hidden option) */
case 'p': main_pause = 1; break; case 'p': main_pause = 1; break;
// Select specific bench algorithm only /* Select specific algorithm to bench */
case 'b': case 'b':
benchNb = 0; benchNb = 0;
while ((argument[1]>= '0') && (argument[1]<= '9')) while ((argument[1]>= '0') && (argument[1]<= '9'))
@@ -613,7 +614,7 @@ int main(int argc, char** argv)
} }
break; break;
// Modify Nb Iterations /* Modify Nb Iterations */
case 'i': case 'i':
if ((argument[1] >='1') && (argument[1] <='9')) if ((argument[1] >='1') && (argument[1] <='9'))
{ {
@@ -623,14 +624,28 @@ int main(int argc, char** argv)
} }
break; break;
// Unknown command /* Select specific algorithm to bench */
case 'P':
{
U32 proba32 = 0;
while ((argument[1]>= '0') && (argument[1]<= '9'))
{
proba32 *= 10;
proba32 += argument[1] - '0';
argument++;
}
g_compressibility = (double)proba32 / 100.;
}
break;
/* Unknown command */
default : badusage(exename); return 1; default : badusage(exename); return 1;
} }
} }
continue; continue;
} }
// first provided filename is input /* first provided filename is input */
if (!input_filename) { input_filename=argument; filenamesStart=i; continue; } if (!input_filename) { input_filename=argument; filenamesStart=i; continue; }
} }