summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Collet <yann.collet.73@gmail.com>2015-04-06 00:02:24 (GMT)
committerYann Collet <yann.collet.73@gmail.com>2015-04-06 00:02:24 (GMT)
commit17f86149c52a3a3c131c23f2b6452f172d9364a6 (patch)
treeb3cb8310c4c85d88ebf015758b6ae98a4980f054
parentd38b0b607f837bdf9ac32da74e04fc62a347cf92 (diff)
downloadlz4-17f86149c52a3a3c131c23f2b6452f172d9364a6.zip
lz4-17f86149c52a3a3c131c23f2b6452f172d9364a6.tar.gz
lz4-17f86149c52a3a3c131c23f2b6452f172d9364a6.tar.bz2
added : memtest on fullbench
-rw-r--r--programs/Makefile3
-rw-r--r--programs/fullbench.c20
2 files changed, 13 insertions, 10 deletions
diff --git a/programs/Makefile b/programs/Makefile
index 9a1bade..3ca46d7 100644
--- a/programs/Makefile
+++ b/programs/Makefile
@@ -243,13 +243,14 @@ test-frametest: frametest
test-frametest32: frametest32
./frametest32
-test-mem: lz4 datagen fuzzer frametest
+test-mem: lz4 datagen fuzzer frametest fullbench
valgrind --leak-check=yes ./datagen -g50M > $(VOID)
./datagen -g16KB > tmp
valgrind --leak-check=yes ./lz4 -9 -BD -f tmp $(VOID)
./datagen -g16MB > tmp
valgrind --leak-check=yes ./lz4 -9 -B5D -f tmp tmp2
valgrind --leak-check=yes ./lz4 -t tmp2
+ valgrind --leak-check=yes ./fullbench -i1 tmp
./datagen -g256MB > tmp
valgrind --leak-check=yes ./lz4 -B4D -f -vq tmp $(VOID)
rm tmp*
diff --git a/programs/fullbench.c b/programs/fullbench.c
index 41075bc..7c970e0 100644
--- a/programs/fullbench.c
+++ b/programs/fullbench.c
@@ -541,12 +541,6 @@ int fullSpeedBench(char** fileNamesTable, int nbFiles)
double totalDTime[NB_DECOMPRESSION_ALGORITHMS+1] = {0};
size_t errorCode;
- errorCode = LZ4F_createDecompressionContext(&g_dCtx, LZ4F_VERSION);
- if (LZ4F_isError(errorCode))
- {
- DISPLAY("dctx allocation issue \n");
- return 10;
- }
/* Loop for each fileName */
while (fileIdx<nbFiles)
@@ -584,6 +578,12 @@ int fullSpeedBench(char** fileNamesTable, int nbFiles)
/* Allocation */
stateLZ4 = LZ4_createStream();
stateLZ4HC = LZ4_createStreamHC();
+ errorCode = LZ4F_createDecompressionContext(&g_dCtx, LZ4F_VERSION);
+ if (LZ4F_isError(errorCode))
+ {
+ DISPLAY("dctx allocation issue \n");
+ return 10;
+ }
chunkP = (struct chunkParameters*) malloc(((benchedSize / (size_t)chunkSize)+1) * sizeof(struct chunkParameters));
orig_buff = (char*) malloc((size_t)benchedSize);
nbChunks = (int) (((int)benchedSize + (chunkSize-1))/ chunkSize);
@@ -629,7 +629,7 @@ int fullSpeedBench(char** fileNamesTable, int nbFiles)
DISPLAY("\r%79s\r", "");
DISPLAY(" %s : \n", inFileName);
- // Compression Algorithms
+ /* Bench Compression Algorithms */
for (cAlgNb=1; (cAlgNb <= NB_COMPRESSION_ALGORITHMS) && (compressionTest); cAlgNb++)
{
const char* compressorName;
@@ -751,7 +751,6 @@ int fullSpeedBench(char** fileNamesTable, int nbFiles)
/* Decompression Algorithms */
for (dAlgNb=1; (dAlgNb <= NB_DECOMPRESSION_ALGORITHMS) && (decompressionTest); dAlgNb++)
{
- //const char* dName = decompressionNames[dAlgNb];
const char* dName;
int (*decompressionFunction)(const char*, char*, int, int);
double bestTime = 100000000.;
@@ -778,7 +777,7 @@ int fullSpeedBench(char** fileNamesTable, int nbFiles)
default : DISPLAY("ERROR ! Bad decompression algorithm Id !! \n"); free(chunkP); return 1;
}
- { size_t i; for (i=0; i<benchedSize; i++) orig_buff[i]=0; } // zeroing source area, for CRC checking
+ { size_t i; for (i=0; i<benchedSize; i++) orig_buff[i]=0; } /* zeroing source area, for CRC checking */
for (loopNb = 1; loopNb <= nbIterations; loopNb++)
{
@@ -823,6 +822,9 @@ int fullSpeedBench(char** fileNamesTable, int nbFiles)
free(orig_buff);
free(compressed_buff);
free(chunkP);
+ LZ4_freeStream(stateLZ4);
+ LZ4_freeStreamHC(stateLZ4HC);
+ LZ4F_freeDecompressionContext(g_dCtx);
}
if (BMK_pause) { printf("press enter...\n"); getchar(); }