aboutsummaryrefslogtreecommitdiff
path: root/zlibWrapper
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2017-11-09 15:38:02 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2017-11-09 15:38:02 +0000
commit653667f9dc9cc0169deeca1a82a60c2e91d5683a (patch)
treeac900fcbc6efae43f50daa8009f04669eeebe02d /zlibWrapper
parent299df5d48ce3c064ef926ac7814c278bcdc92db0 (diff)
import zstd 1.3.2vendor/zstd/1.3.2
Diffstat (limited to 'zlibWrapper')
-rw-r--r--zlibWrapper/Makefile2
-rw-r--r--zlibWrapper/examples/zwrapbench.c41
-rw-r--r--zlibWrapper/gzcompatibility.h3
-rw-r--r--zlibWrapper/zstd_zlibwrapper.c3
-rw-r--r--zlibWrapper/zstd_zlibwrapper.h3
5 files changed, 26 insertions, 26 deletions
diff --git a/zlibWrapper/Makefile b/zlibWrapper/Makefile
index 4e8fb4a329b6..c1896f8b80a3 100644
--- a/zlibWrapper/Makefile
+++ b/zlibWrapper/Makefile
@@ -34,7 +34,7 @@ EXT =
endif
-all: clean fitblk example zwrapbench minigzip
+all: fitblk example zwrapbench minigzip
test: example fitblk example_zstd fitblk_zstd zwrapbench minigzip minigzip_zstd
./example
diff --git a/zlibWrapper/examples/zwrapbench.c b/zlibWrapper/examples/zwrapbench.c
index 050c9db63218..25a23f885737 100644
--- a/zlibWrapper/examples/zwrapbench.c
+++ b/zlibWrapper/examples/zwrapbench.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
+ * Copyright (c) 2016-present, Przemyslaw Skibinski, Yann Collet, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under both the BSD-style license (found in the
@@ -36,7 +36,6 @@
#endif
-
/*-************************************
* Constants
**************************************/
@@ -162,7 +161,6 @@ static int BMK_benchMem(z_const void* srcBuffer, size_t srcSize,
ZSTD_CCtx* const ctx = ZSTD_createCCtx();
ZSTD_DCtx* const dctx = ZSTD_createDCtx();
U32 nbBlocks;
- UTIL_freq_t ticksPerSecond;
/* checks */
if (!compressedBuffer || !resultBuffer || !blockTable || !ctx || !dctx)
@@ -170,7 +168,6 @@ static int BMK_benchMem(z_const void* srcBuffer, size_t srcSize,
/* init */
if (strlen(displayName)>17) displayName += strlen(displayName)-17; /* can only display 17 characters */
- UTIL_initTimer(&ticksPerSecond);
/* Init blockTable data */
{ z_const char* srcPtr = (z_const char*)srcBuffer;
@@ -210,17 +207,17 @@ static int BMK_benchMem(z_const void* srcBuffer, size_t srcSize,
size_t cSize = 0;
double ratio = 0.;
- UTIL_getTime(&coolTime);
+ coolTime = UTIL_getTime();
DISPLAYLEVEL(2, "\r%79s\r", "");
while (!cCompleted | !dCompleted) {
UTIL_time_t clockStart;
U64 clockLoop = g_nbIterations ? TIMELOOP_MICROSEC : 1;
/* overheat protection */
- if (UTIL_clockSpanMicro(coolTime, ticksPerSecond) > ACTIVEPERIOD_MICROSEC) {
+ if (UTIL_clockSpanMicro(coolTime) > ACTIVEPERIOD_MICROSEC) {
DISPLAYLEVEL(2, "\rcooling down ... \r");
UTIL_sleep(COOLPERIOD_SEC);
- UTIL_getTime(&coolTime);
+ coolTime = UTIL_getTime();
}
/* Compression */
@@ -228,15 +225,15 @@ static int BMK_benchMem(z_const void* srcBuffer, size_t srcSize,
if (!cCompleted) memset(compressedBuffer, 0xE5, maxCompressedSize); /* warm up and erase result buffer */
UTIL_sleepMilli(1); /* give processor time to other processes */
- UTIL_waitForNextTick(ticksPerSecond);
- UTIL_getTime(&clockStart);
+ UTIL_waitForNextTick();
+ clockStart = UTIL_getTime();
if (!cCompleted) { /* still some time to do compression tests */
U32 nbLoops = 0;
if (compressor == BMK_ZSTD) {
ZSTD_parameters const zparams = ZSTD_getParams(cLevel, avgSize, dictBufferSize);
ZSTD_customMem const cmem = { NULL, NULL, NULL };
- ZSTD_CDict* const cdict = ZSTD_createCDict_advanced(dictBuffer, dictBufferSize, 1 /*byRef*/, ZSTD_dm_auto, zparams.cParams, cmem);
+ ZSTD_CDict* const cdict = ZSTD_createCDict_advanced(dictBuffer, dictBufferSize, ZSTD_dlm_byRef, ZSTD_dm_auto, zparams.cParams, cmem);
if (cdict==NULL) EXM_THROW(1, "ZSTD_createCDict_advanced() allocation failure");
do {
@@ -257,7 +254,7 @@ static int BMK_benchMem(z_const void* srcBuffer, size_t srcSize,
blockTable[blockNb].cSize = rSize;
}
nbLoops++;
- } while (UTIL_clockSpanMicro(clockStart, ticksPerSecond) < clockLoop);
+ } while (UTIL_clockSpanMicro(clockStart) < clockLoop);
ZSTD_freeCDict(cdict);
} else if (compressor == BMK_ZSTD_STREAM) {
ZSTD_parameters const zparams = ZSTD_getParams(cLevel, avgSize, dictBufferSize);
@@ -286,7 +283,7 @@ static int BMK_benchMem(z_const void* srcBuffer, size_t srcSize,
blockTable[blockNb].cSize = outBuffer.pos;
}
nbLoops++;
- } while (UTIL_clockSpanMicro(clockStart, ticksPerSecond) < clockLoop);
+ } while (UTIL_clockSpanMicro(clockStart) < clockLoop);
ZSTD_freeCStream(zbc);
} else if (compressor == BMK_ZWRAP_ZLIB_REUSE || compressor == BMK_ZWRAP_ZSTD_REUSE || compressor == BMK_ZLIB_REUSE) {
z_stream def;
@@ -327,7 +324,7 @@ static int BMK_benchMem(z_const void* srcBuffer, size_t srcSize,
blockTable[blockNb].cSize = def.total_out;
}
nbLoops++;
- } while (UTIL_clockSpanMicro(clockStart, ticksPerSecond) < clockLoop);
+ } while (UTIL_clockSpanMicro(clockStart) < clockLoop);
ret = deflateEnd(&def);
if (ret != Z_OK) EXM_THROW(1, "deflateEnd failure");
} else {
@@ -360,9 +357,9 @@ static int BMK_benchMem(z_const void* srcBuffer, size_t srcSize,
blockTable[blockNb].cSize = def.total_out;
}
nbLoops++;
- } while (UTIL_clockSpanMicro(clockStart, ticksPerSecond) < clockLoop);
+ } while (UTIL_clockSpanMicro(clockStart) < clockLoop);
}
- { U64 const clockSpan = UTIL_clockSpanMicro(clockStart, ticksPerSecond);
+ { U64 const clockSpan = UTIL_clockSpanMicro(clockStart);
if (clockSpan < fastestC*nbLoops) fastestC = clockSpan / nbLoops;
totalCTime += clockSpan;
cCompleted = totalCTime>maxTime;
@@ -382,8 +379,8 @@ static int BMK_benchMem(z_const void* srcBuffer, size_t srcSize,
if (!dCompleted) memset(resultBuffer, 0xD6, srcSize); /* warm result buffer */
UTIL_sleepMilli(1); /* give processor time to other processes */
- UTIL_waitForNextTick(ticksPerSecond);
- UTIL_getTime(&clockStart);
+ UTIL_waitForNextTick();
+ clockStart = UTIL_getTime();
if (!dCompleted) {
U32 nbLoops = 0;
@@ -406,7 +403,7 @@ static int BMK_benchMem(z_const void* srcBuffer, size_t srcSize,
blockTable[blockNb].resSize = regenSize;
}
nbLoops++;
- } while (UTIL_clockSpanMicro(clockStart, ticksPerSecond) < clockLoop);
+ } while (UTIL_clockSpanMicro(clockStart) < clockLoop);
ZSTD_freeDDict(ddict);
} else if (compressor == BMK_ZSTD_STREAM) {
ZSTD_inBuffer inBuffer;
@@ -432,7 +429,7 @@ static int BMK_benchMem(z_const void* srcBuffer, size_t srcSize,
blockTable[blockNb].resSize = outBuffer.pos;
}
nbLoops++;
- } while (UTIL_clockSpanMicro(clockStart, ticksPerSecond) < clockLoop);
+ } while (UTIL_clockSpanMicro(clockStart) < clockLoop);
ZSTD_freeDStream(zbd);
} else if (compressor == BMK_ZWRAP_ZLIB_REUSE || compressor == BMK_ZWRAP_ZSTD_REUSE || compressor == BMK_ZLIB_REUSE) {
z_stream inf;
@@ -468,7 +465,7 @@ static int BMK_benchMem(z_const void* srcBuffer, size_t srcSize,
blockTable[blockNb].resSize = inf.total_out;
}
nbLoops++;
- } while (UTIL_clockSpanMicro(clockStart, ticksPerSecond) < clockLoop);
+ } while (UTIL_clockSpanMicro(clockStart) < clockLoop);
ret = inflateEnd(&inf);
if (ret != Z_OK) EXM_THROW(1, "inflateEnd failure");
} else {
@@ -502,9 +499,9 @@ static int BMK_benchMem(z_const void* srcBuffer, size_t srcSize,
blockTable[blockNb].resSize = inf.total_out;
}
nbLoops++;
- } while (UTIL_clockSpanMicro(clockStart, ticksPerSecond) < clockLoop);
+ } while (UTIL_clockSpanMicro(clockStart) < clockLoop);
}
- { U64 const clockSpan = UTIL_clockSpanMicro(clockStart, ticksPerSecond);
+ { U64 const clockSpan = UTIL_clockSpanMicro(clockStart);
if (clockSpan < fastestD*nbLoops) fastestD = clockSpan / nbLoops;
totalDTime += clockSpan;
dCompleted = totalDTime>maxTime;
diff --git a/zlibWrapper/gzcompatibility.h b/zlibWrapper/gzcompatibility.h
index ac9020acc15b..ea8d50c8238a 100644
--- a/zlibWrapper/gzcompatibility.h
+++ b/zlibWrapper/gzcompatibility.h
@@ -1,10 +1,11 @@
/*
- * Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
+ * Copyright (c) 2016-present, Przemyslaw Skibinski, Yann Collet, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under both the BSD-style license (found in the
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
* in the COPYING file in the root directory of this source tree).
+ * You may select, at your option, one of the above-listed licenses.
*/
diff --git a/zlibWrapper/zstd_zlibwrapper.c b/zlibWrapper/zstd_zlibwrapper.c
index 272369a2874c..c5fbdf98e19d 100644
--- a/zlibWrapper/zstd_zlibwrapper.c
+++ b/zlibWrapper/zstd_zlibwrapper.c
@@ -1,10 +1,11 @@
/*
- * Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
+ * Copyright (c) 2016-present, Przemyslaw Skibinski, Yann Collet, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under both the BSD-style license (found in the
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
* in the COPYING file in the root directory of this source tree).
+ * You may select, at your option, one of the above-listed licenses.
*/
diff --git a/zlibWrapper/zstd_zlibwrapper.h b/zlibWrapper/zstd_zlibwrapper.h
index f8f36800928e..f828d3191b87 100644
--- a/zlibWrapper/zstd_zlibwrapper.h
+++ b/zlibWrapper/zstd_zlibwrapper.h
@@ -1,10 +1,11 @@
/*
- * Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
+ * Copyright (c) 2016-present, Przemyslaw Skibinski, Yann Collet, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under both the BSD-style license (found in the
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
* in the COPYING file in the root directory of this source tree).
+ * You may select, at your option, one of the above-listed licenses.
*/
#ifndef ZSTD_ZLIBWRAPPER_H