mirror of
https://github.com/facebook/zstd.git
synced 2025-07-30 22:23:13 +03:00
bench: changed creation/reset function to timedFnState
for consistency
This commit is contained in:
@ -349,23 +349,23 @@ BMK_customReturn_t BMK_benchFunction(
|
|||||||
|
|
||||||
#define MINUSABLETIME 500000000ULL /* 0.5 seconds in ns */
|
#define MINUSABLETIME 500000000ULL /* 0.5 seconds in ns */
|
||||||
|
|
||||||
void BMK_resetTimeState(BMK_timedFnState_t* r, unsigned nbSeconds) {
|
void BMK_resetTimedFnState(BMK_timedFnState_t* r, unsigned nbSeconds) {
|
||||||
r->nbLoops = 1;
|
r->nbLoops = 1;
|
||||||
r->timeRemaining = (U64)nbSeconds * TIMELOOP_NANOSEC;
|
r->timeRemaining = (U64)nbSeconds * TIMELOOP_NANOSEC;
|
||||||
r->coolTime = UTIL_getTime();
|
r->coolTime = UTIL_getTime();
|
||||||
r->fastestTime = (U64)(-1LL);
|
r->fastestTime = (U64)(-1LL);
|
||||||
}
|
}
|
||||||
|
|
||||||
BMK_timedFnState_t* BMK_createTimeState(unsigned nbSeconds) {
|
BMK_timedFnState_t* BMK_createTimedFnState(unsigned nbSeconds) {
|
||||||
BMK_timedFnState_t* r = (BMK_timedFnState_t*)malloc(sizeof(struct BMK_timeState_t));
|
BMK_timedFnState_t* r = (BMK_timedFnState_t*)malloc(sizeof(struct BMK_timeState_t));
|
||||||
if(r == NULL) {
|
if(r == NULL) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
BMK_resetTimeState(r, nbSeconds);
|
BMK_resetTimedFnState(r, nbSeconds);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BMK_freeTimeState(BMK_timedFnState_t* state) {
|
void BMK_freeTimedFnState(BMK_timedFnState_t* state) {
|
||||||
free(state);
|
free(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -727,8 +727,8 @@ BMK_return_t BMK_benchMemAdvanced(const void* srcBuffer, size_t srcSize,
|
|||||||
void ** const resPtrs = (void**)malloc(maxNbBlocks * sizeof(void*));
|
void ** const resPtrs = (void**)malloc(maxNbBlocks * sizeof(void*));
|
||||||
size_t* const resSizes = (size_t*)malloc(maxNbBlocks * sizeof(size_t));
|
size_t* const resSizes = (size_t*)malloc(maxNbBlocks * sizeof(size_t));
|
||||||
|
|
||||||
BMK_timedFnState_t* timeStateCompress = BMK_createTimeState(adv->nbSeconds);
|
BMK_timedFnState_t* timeStateCompress = BMK_createTimedFnState(adv->nbSeconds);
|
||||||
BMK_timedFnState_t* timeStateDecompress = BMK_createTimeState(adv->nbSeconds);
|
BMK_timedFnState_t* timeStateDecompress = BMK_createTimedFnState(adv->nbSeconds);
|
||||||
|
|
||||||
ZSTD_CCtx* ctx = ZSTD_createCCtx();
|
ZSTD_CCtx* ctx = ZSTD_createCCtx();
|
||||||
ZSTD_DCtx* dctx = ZSTD_createDCtx();
|
ZSTD_DCtx* dctx = ZSTD_createDCtx();
|
||||||
@ -758,8 +758,8 @@ BMK_return_t BMK_benchMemAdvanced(const void* srcBuffer, size_t srcSize,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* clean up */
|
/* clean up */
|
||||||
BMK_freeTimeState(timeStateCompress);
|
BMK_freeTimedFnState(timeStateCompress);
|
||||||
BMK_freeTimeState(timeStateDecompress);
|
BMK_freeTimedFnState(timeStateDecompress);
|
||||||
|
|
||||||
ZSTD_freeCCtx(ctx);
|
ZSTD_freeCCtx(ctx);
|
||||||
ZSTD_freeDCtx(dctx);
|
ZSTD_freeDCtx(dctx);
|
||||||
|
168
programs/bench.h
168
programs/bench.h
@ -19,11 +19,12 @@ extern "C" {
|
|||||||
#define ZSTD_STATIC_LINKING_ONLY /* ZSTD_compressionParameters */
|
#define ZSTD_STATIC_LINKING_ONLY /* ZSTD_compressionParameters */
|
||||||
#include "zstd.h" /* ZSTD_compressionParameters */
|
#include "zstd.h" /* ZSTD_compressionParameters */
|
||||||
|
|
||||||
/* Creates a struct of type typeName with an int type .error field
|
/* Creates a struct type typeName, featuring:
|
||||||
* and a .result field of some baseType. Functions with return
|
* - an .error field of type int
|
||||||
* typeName pass a successful result with .error = 0 and .result
|
* - a .result field of some baseType.
|
||||||
* with the intended result, while returning an error will result
|
* Functions with return type typeName
|
||||||
* in .error != 0.
|
* will either be successful, with .error = 0, providing a valid .result,
|
||||||
|
* or return an error, with .error != 0, in which case .result is invalid.
|
||||||
*/
|
*/
|
||||||
#define ERROR_STRUCT(baseType, typeName) typedef struct { \
|
#define ERROR_STRUCT(baseType, typeName) typedef struct { \
|
||||||
baseType result; \
|
baseType result; \
|
||||||
@ -32,36 +33,37 @@ extern "C" {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
size_t cSize;
|
size_t cSize;
|
||||||
U64 cSpeed; /* bytes / sec */
|
unsigned long long cSpeed; /* bytes / sec */
|
||||||
U64 dSpeed;
|
unsigned long long dSpeed;
|
||||||
size_t cMem;
|
size_t cMem; /* ? what does it reports ? */
|
||||||
} BMK_result_t;
|
} BMK_result_t;
|
||||||
|
|
||||||
ERROR_STRUCT(BMK_result_t, BMK_return_t);
|
ERROR_STRUCT(BMK_result_t, BMK_return_t);
|
||||||
|
|
||||||
/* called in cli */
|
/*! BMK_benchFiles() -- called by zstdcli */
|
||||||
/* Loads files in fileNamesTable into memory, as well as a dictionary
|
/* Loads files from fileNamesTable into memory,
|
||||||
* from dictFileName, and then uses benchMem */
|
* loads dictionary from dictFileName,
|
||||||
/* fileNamesTable - name of files to benchmark
|
* then uses benchMem().
|
||||||
* nbFiles - number of files (size of fileNamesTable), must be > 0
|
* fileNamesTable - name of files to benchmark
|
||||||
* dictFileName - name of dictionary file to load
|
* nbFiles - number of files (size of fileNamesTable), must be > 0 (what happens if not ?)
|
||||||
* cLevel - compression level to benchmark, errors if invalid
|
* dictFileName - name of dictionary file to load
|
||||||
* compressionParams - basic compression Parameters
|
* cLevel - compression level to benchmark, errors if invalid
|
||||||
* displayLevel - what gets printed
|
* compressionParams - advanced compression Parameters
|
||||||
|
* displayLevel - what gets printed
|
||||||
* 0 : no display;
|
* 0 : no display;
|
||||||
* 1 : errors;
|
* 1 : errors;
|
||||||
* 2 : + result + interaction + warnings;
|
* 2 : + result + interaction + warnings;
|
||||||
* 3 : + progression;
|
* 3 : + progression;
|
||||||
* 4 : + information
|
* 4 : + information
|
||||||
* return
|
* @return
|
||||||
* .error will give a nonzero error value if an error has occured
|
* .error will give a nonzero error value if an error has occured
|
||||||
* .result - if .error = 0, .result will return the time taken to compression speed
|
* .result - only valid if .error = 0,
|
||||||
* (.cSpeed), decompression speed (.dSpeed), and compressed size (.cSize) of the original
|
* .result will return compression speed (.cSpeed),
|
||||||
* file
|
* decompression speed (.dSpeed), and compressed size (.cSize).
|
||||||
*/
|
*/
|
||||||
BMK_return_t BMK_benchFiles(const char* const * const fileNamesTable, unsigned const nbFiles,
|
BMK_return_t BMK_benchFiles(const char* const * fileNamesTable, unsigned nbFiles,
|
||||||
const char* const dictFileName,
|
const char* dictFileName,
|
||||||
int const cLevel, const ZSTD_compressionParameters* const compressionParams,
|
int cLevel, const ZSTD_compressionParameters* compressionParams,
|
||||||
int displayLevel);
|
int displayLevel);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -93,67 +95,75 @@ typedef struct {
|
|||||||
/* returns default parameters used by nonAdvanced functions */
|
/* returns default parameters used by nonAdvanced functions */
|
||||||
BMK_advancedParams_t BMK_initAdvancedParams(void);
|
BMK_advancedParams_t BMK_initAdvancedParams(void);
|
||||||
|
|
||||||
/* See benchFiles for normal parameter uses and return, see advancedParams_t for adv */
|
/*! BMK_benchFilesAdvanced():
|
||||||
BMK_return_t BMK_benchFilesAdvanced(const char* const * const fileNamesTable, unsigned const nbFiles,
|
* Same as BMK_benchFiles(),
|
||||||
const char* const dictFileName,
|
* with more controls, provided through advancedParams_t structure */
|
||||||
int const cLevel, const ZSTD_compressionParameters* const compressionParams,
|
BMK_return_t BMK_benchFilesAdvanced(const char* const * fileNamesTable, unsigned nbFiles,
|
||||||
int displayLevel, const BMK_advancedParams_t* const adv);
|
const char* dictFileName,
|
||||||
|
int cLevel, const ZSTD_compressionParameters* compressionParams,
|
||||||
|
int displayLevel, const BMK_advancedParams_t* adv);
|
||||||
|
|
||||||
/* called in cli */
|
/*! BMK_syntheticTest() -- called from zstdcli */
|
||||||
/* Generates a sample with datagen with the compressibility argument*/
|
/* Generates a sample with datagen, using compressibility argument */
|
||||||
/* cLevel - compression level to benchmark, errors if invalid
|
/* cLevel - compression level to benchmark, errors if invalid
|
||||||
* compressibility - determines compressibility of sample
|
* compressibility - determines compressibility of sample
|
||||||
* compressionParams - basic compression Parameters
|
* compressionParams - basic compression Parameters
|
||||||
* displayLevel - see benchFiles
|
* displayLevel - see benchFiles
|
||||||
* adv - see advanced_Params_t
|
* adv - see advanced_Params_t
|
||||||
* return
|
* @return:
|
||||||
* .error will give a nonzero error value if an error has occured
|
* .error will give a nonzero error value if an error has occured
|
||||||
* .result - if .error = 0, .result will return the time taken to compression speed
|
* .result - only valid if .error = 0,
|
||||||
* (.cSpeed), decompression speed (.dSpeed), and compressed size (.cSize) of the original
|
* .result will return the compression speed (.cSpeed),
|
||||||
* file
|
* decompression speed (.dSpeed), and compressed size (.cSize).
|
||||||
*/
|
*/
|
||||||
BMK_return_t BMK_syntheticTest(int cLevel, double compressibility,
|
BMK_return_t BMK_syntheticTest(int cLevel, double compressibility,
|
||||||
const ZSTD_compressionParameters* compressionParams,
|
const ZSTD_compressionParameters* compressionParams,
|
||||||
int displayLevel, const BMK_advancedParams_t * const adv);
|
int displayLevel, const BMK_advancedParams_t * const adv);
|
||||||
|
|
||||||
/* basic benchmarking function, called in paramgrill
|
/** BMK_benchMem() -- core benchmarking function, called in paramgrill
|
||||||
* applies ZSTD_compress_generic() and ZSTD_decompress_generic() on data in srcBuffer
|
* applies ZSTD_compress_generic() and ZSTD_decompress_generic() on data in srcBuffer
|
||||||
* with specific compression parameters specified by other arguments using benchFunction
|
* with specific compression parameters provided by other arguments using benchFunction
|
||||||
* (cLevel, comprParams + adv in advanced Mode) */
|
* (cLevel, comprParams + adv in advanced Mode) */
|
||||||
/* srcBuffer - data source, expected to be valid compressed data if in Decode Only Mode
|
/* srcBuffer - data source, expected to be valid compressed data if in Decode Only Mode
|
||||||
* srcSize - size of data in srcBuffer
|
* srcSize - size of data in srcBuffer
|
||||||
* cLevel - compression level
|
* fileSizes - srcBuffer is considered cut into 1+ segments, to compress separately.
|
||||||
* comprParams - basic compression parameters
|
* note : sum(fileSizes) must be == srcSize. (<== ensure it's properly checked)
|
||||||
* dictBuffer - a dictionary if used, null otherwise
|
* nbFiles - nb of segments
|
||||||
* dictBufferSize - size of dictBuffer, 0 otherwise
|
* cLevel - compression level
|
||||||
* diplayLevel - see BMK_benchFiles
|
* comprParams - basic compression parameters
|
||||||
* displayName - name used by display
|
* dictBuffer - a dictionary if used, null otherwise
|
||||||
* return
|
* dictBufferSize - size of dictBuffer, 0 otherwise
|
||||||
|
* diplayLevel - see BMK_benchFiles
|
||||||
|
* displayName - name used by display
|
||||||
|
* @return
|
||||||
* .error will give a nonzero value if an error has occured
|
* .error will give a nonzero value if an error has occured
|
||||||
* .result - if .error = 0, will give the same results as benchFiles
|
* .result - only valid if .error = 0,
|
||||||
|
* provide the same results as benchFiles()
|
||||||
* but for the data stored in srcBuffer
|
* but for the data stored in srcBuffer
|
||||||
*/
|
*/
|
||||||
BMK_return_t BMK_benchMem(const void* srcBuffer, size_t srcSize,
|
BMK_return_t BMK_benchMem(const void* srcBuffer, size_t srcSize,
|
||||||
const size_t* fileSizes, unsigned nbFiles,
|
const size_t* fileSizes, unsigned nbFiles,
|
||||||
const int cLevel, const ZSTD_compressionParameters* comprParams,
|
int cLevel, const ZSTD_compressionParameters* comprParams,
|
||||||
const void* dictBuffer, size_t dictBufferSize,
|
const void* dictBuffer, size_t dictBufferSize,
|
||||||
int displayLevel, const char* displayName);
|
int displayLevel, const char* displayName);
|
||||||
|
|
||||||
/* See benchMem for normal parameter uses and return, see advancedParams_t for adv
|
/* BMK_benchMemAdvanced() : same as BMK_benchMem()
|
||||||
|
* with following additional options :
|
||||||
* dstBuffer - destination buffer to write compressed output in, NULL if none provided.
|
* dstBuffer - destination buffer to write compressed output in, NULL if none provided.
|
||||||
* dstCapacity - capacity of destination buffer, give 0 if dstBuffer = NULL
|
* dstCapacity - capacity of destination buffer, give 0 if dstBuffer = NULL
|
||||||
|
* adv = see advancedParams_t
|
||||||
*/
|
*/
|
||||||
BMK_return_t BMK_benchMemAdvanced(const void* srcBuffer, size_t srcSize,
|
BMK_return_t BMK_benchMemAdvanced(const void* srcBuffer, size_t srcSize,
|
||||||
void* dstBuffer, size_t dstCapacity,
|
void* dstBuffer, size_t dstCapacity,
|
||||||
const size_t* fileSizes, unsigned nbFiles,
|
const size_t* fileSizes, unsigned nbFiles,
|
||||||
const int cLevel, const ZSTD_compressionParameters* comprParams,
|
int cLevel, const ZSTD_compressionParameters* comprParams,
|
||||||
const void* dictBuffer, size_t dictBufferSize,
|
const void* dictBuffer, size_t dictBufferSize,
|
||||||
int displayLevel, const char* displayName,
|
int displayLevel, const char* displayName,
|
||||||
const BMK_advancedParams_t* adv);
|
const BMK_advancedParams_t* adv);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
size_t sumOfReturn; /* sum of return values */
|
size_t sumOfReturn; /* sum of return values */
|
||||||
U64 nanoSecPerRun; /* time per iteration */
|
unsigned long long nanoSecPerRun; /* time per iteration */
|
||||||
} BMK_customResult_t;
|
} BMK_customResult_t;
|
||||||
|
|
||||||
ERROR_STRUCT(BMK_customResult_t, BMK_customReturn_t);
|
ERROR_STRUCT(BMK_customResult_t, BMK_customReturn_t);
|
||||||
@ -167,58 +177,58 @@ typedef size_t (*BMK_initFn_t)(void*);
|
|||||||
* is run nbLoops times
|
* is run nbLoops times
|
||||||
* initFn - (*initFn)(initPayload) is run once per benchmark at the beginning. This argument can
|
* initFn - (*initFn)(initPayload) is run once per benchmark at the beginning. This argument can
|
||||||
* be NULL, in which case nothing is run.
|
* be NULL, in which case nothing is run.
|
||||||
* blockCount - number of blocks (size of srcBuffers, srcSizes, dstBuffers, dstCapacities)
|
* blockCount - number of blocks. Size of all array parameters : srcBuffers, srcSizes, dstBuffers, dstCapacities, blockResults
|
||||||
* srcBuffers - an array of buffers to be operated on by benchFn
|
* srcBuffers - an array of buffers to be operated on by benchFn
|
||||||
* srcSizes - an array of the sizes of above buffers
|
* srcSizes - an array of the sizes of above buffers
|
||||||
* dstBuffers - an array of buffers to be written into by benchFn
|
* dstBuffers - an array of buffers to be written into by benchFn
|
||||||
* dstCapacities - an array of the capacities of above buffers
|
* dstCapacities - an array of the capacities of above buffers
|
||||||
* blockResults - the return value of benchFn called on each block.
|
* blockResults - the return value of benchFn called on each block.
|
||||||
* nbLoops - defines number of times benchFn is run.
|
* nbLoops - defines number of times benchFn is run.
|
||||||
* assumed array of size blockCount, will have compressed size of each block written to it.
|
* @return:
|
||||||
* return
|
|
||||||
* .error will give a nonzero value if ZSTD_isError() is nonzero for any of the return
|
* .error will give a nonzero value if ZSTD_isError() is nonzero for any of the return
|
||||||
* of the calls to initFn and benchFn, or if benchFunction errors internally
|
* of the calls to initFn and benchFn, or if benchFunction errors internally
|
||||||
* .result - if .error = 0, then .result will contain the sum of all return values of
|
* .result - if .error = 0, then .result will contain
|
||||||
* benchFn on the first iteration through all of the blocks (.sumOfReturn) and also
|
* the sum of all return values of benchFn on the first iteration through all of the blocks (.sumOfReturn)
|
||||||
* the time per run of benchFn (.nanoSecPerRun). For the former, this
|
* and also the time per run of benchFn (.nanoSecPerRun).
|
||||||
* is generally intended to be used on functions which return the # of bytes written
|
* For the former, this is generally intended to be used on functions which return the # of bytes written into dstBuffer,
|
||||||
* into dstBuffer, hence this value will be the total amount of bytes written to
|
* hence this value will be the total amount of bytes written into dstBuffer.
|
||||||
* dstBuffer.
|
|
||||||
*/
|
*/
|
||||||
BMK_customReturn_t BMK_benchFunction(BMK_benchFn_t benchFn, void* benchPayload,
|
BMK_customReturn_t BMK_benchFunction(BMK_benchFn_t benchFn, void* benchPayload,
|
||||||
BMK_initFn_t initFn, void* initPayload,
|
BMK_initFn_t initFn, void* initPayload,
|
||||||
size_t blockCount,
|
size_t blockCount,
|
||||||
const void* const * const srcBuffers, const size_t* srcSizes,
|
const void *const * srcBuffers, const size_t* srcSizes,
|
||||||
void * const * const dstBuffers, const size_t* dstCapacities, size_t* blockResults,
|
void *const * dstBuffers, const size_t* dstCapacities, size_t* blockResults,
|
||||||
unsigned nbLoops);
|
unsigned nbLoops);
|
||||||
|
|
||||||
|
|
||||||
/* state information needed to advance computation for benchFunctionTimed */
|
/* state information needed to advance computation for benchFunctionTimed */
|
||||||
typedef struct BMK_timeState_t BMK_timedFnState_t;
|
typedef struct BMK_timeState_t BMK_timedFnState_t;
|
||||||
/* initializes timeState object with desired number of seconds */
|
/* initializes timeState object with desired number of seconds */
|
||||||
BMK_timedFnState_t* BMK_createTimeState(unsigned nbSeconds);
|
BMK_timedFnState_t* BMK_createTimedFnState(unsigned nbSeconds);
|
||||||
/* resets existing timeState object */
|
/* resets existing timeState object */
|
||||||
void BMK_resetTimeState(BMK_timedFnState_t*, unsigned nbSeconds);
|
void BMK_resetTimedFnState(BMK_timedFnState_t*, unsigned nbSeconds);
|
||||||
/* deletes timeState object */
|
/* deletes timeState object */
|
||||||
void BMK_freeTimeState(BMK_timedFnState_t* state);
|
void BMK_freeTimedFnState(BMK_timedFnState_t* state);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
BMK_customReturn_t result;
|
BMK_customReturn_t result;
|
||||||
int completed;
|
int completed;
|
||||||
} BMK_customTimedReturn_t;
|
} BMK_customTimedReturn_t;
|
||||||
|
|
||||||
/*
|
/* BMK_benchFunctionTimed() :
|
||||||
* Benchmarks custom functions like BMK_benchFunction(), but runs for nbSeconds seconds rather than a fixed number of loops
|
* Same as BMK_benchFunction(), but runs for nbSeconds seconds rather than a fixed number of loops.
|
||||||
* arguments mostly the same other than BMK_benchFunction()
|
* Arguments are mostly the same other as BMK_benchFunction()
|
||||||
* Usage - benchFunctionTimed will return in approximately one second. Keep calling BMK_benchFunctionTimed() until the return's completed field = 1.
|
* Usage - benchFunctionTimed will return in approximately one second.
|
||||||
* to continue updating intermediate result. Intermediate return values are returned by the function.
|
* Keep calling BMK_benchFunctionTimed() until @return.completed == 1,
|
||||||
|
* to continue updating intermediate result.
|
||||||
|
* Intermediate return values are returned by the function.
|
||||||
*/
|
*/
|
||||||
BMK_customTimedReturn_t BMK_benchFunctionTimed(BMK_timedFnState_t* cont,
|
BMK_customTimedReturn_t BMK_benchFunctionTimed(BMK_timedFnState_t* cont,
|
||||||
BMK_benchFn_t benchFn, void* benchPayload,
|
BMK_benchFn_t benchFn, void* benchPayload,
|
||||||
BMK_initFn_t initFn, void* initPayload,
|
BMK_initFn_t initFn, void* initPayload,
|
||||||
size_t blockCount,
|
size_t blockCount,
|
||||||
const void* const * const srcBlockBuffers, const size_t* srcBlockSizes,
|
const void *const * srcBlockBuffers, const size_t* srcBlockSizes,
|
||||||
void* const * const dstBlockBuffers, const size_t* dstBlockCapacities, size_t* blockResults);
|
void *const * dstBlockBuffers, const size_t* dstBlockCapacities, size_t* blockResults);
|
||||||
|
|
||||||
#endif /* BENCH_H_121279284357 */
|
#endif /* BENCH_H_121279284357 */
|
||||||
|
|
||||||
|
@ -1428,8 +1428,8 @@ static BMK_return_t BMK_benchMemInvertible(const buffers_t buf, const contexts_t
|
|||||||
if(loopMode == BMK_timeMode) {
|
if(loopMode == BMK_timeMode) {
|
||||||
BMK_customTimedReturn_t intermediateResultCompress;
|
BMK_customTimedReturn_t intermediateResultCompress;
|
||||||
BMK_customTimedReturn_t intermediateResultDecompress;
|
BMK_customTimedReturn_t intermediateResultDecompress;
|
||||||
BMK_timedFnState_t* timeStateCompress = BMK_createTimeState(nbSeconds);
|
BMK_timedFnState_t* timeStateCompress = BMK_createTimedFnState(nbSeconds);
|
||||||
BMK_timedFnState_t* timeStateDecompress = BMK_createTimeState(nbSeconds);
|
BMK_timedFnState_t* timeStateDecompress = BMK_createTimedFnState(nbSeconds);
|
||||||
if(mode == BMK_compressOnly) {
|
if(mode == BMK_compressOnly) {
|
||||||
intermediateResultCompress.completed = 0;
|
intermediateResultCompress.completed = 0;
|
||||||
intermediateResultDecompress.completed = 1;
|
intermediateResultDecompress.completed = 1;
|
||||||
@ -1447,8 +1447,8 @@ static BMK_return_t BMK_benchMemInvertible(const buffers_t buf, const contexts_t
|
|||||||
|
|
||||||
if(intermediateResultCompress.result.error) {
|
if(intermediateResultCompress.result.error) {
|
||||||
results.error = intermediateResultCompress.result.error;
|
results.error = intermediateResultCompress.result.error;
|
||||||
BMK_freeTimeState(timeStateCompress);
|
BMK_freeTimedFnState(timeStateCompress);
|
||||||
BMK_freeTimeState(timeStateDecompress);
|
BMK_freeTimedFnState(timeStateDecompress);
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
results.result.cSpeed = (srcSize * TIMELOOP_NANOSEC) / intermediateResultCompress.result.result.nanoSecPerRun;
|
results.result.cSpeed = (srcSize * TIMELOOP_NANOSEC) / intermediateResultCompress.result.result.nanoSecPerRun;
|
||||||
@ -1461,15 +1461,15 @@ static BMK_return_t BMK_benchMemInvertible(const buffers_t buf, const contexts_t
|
|||||||
|
|
||||||
if(intermediateResultDecompress.result.error) {
|
if(intermediateResultDecompress.result.error) {
|
||||||
results.error = intermediateResultDecompress.result.error;
|
results.error = intermediateResultDecompress.result.error;
|
||||||
BMK_freeTimeState(timeStateCompress);
|
BMK_freeTimedFnState(timeStateCompress);
|
||||||
BMK_freeTimeState(timeStateDecompress);
|
BMK_freeTimedFnState(timeStateDecompress);
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
results.result.dSpeed = (srcSize * TIMELOOP_NANOSEC) / intermediateResultDecompress.result.result.nanoSecPerRun;
|
results.result.dSpeed = (srcSize * TIMELOOP_NANOSEC) / intermediateResultDecompress.result.result.nanoSecPerRun;
|
||||||
}
|
}
|
||||||
|
|
||||||
BMK_freeTimeState(timeStateCompress);
|
BMK_freeTimedFnState(timeStateCompress);
|
||||||
BMK_freeTimeState(timeStateDecompress);
|
BMK_freeTimedFnState(timeStateDecompress);
|
||||||
|
|
||||||
} else { /* iterMode; */
|
} else { /* iterMode; */
|
||||||
if(mode != BMK_decodeOnly) {
|
if(mode != BMK_decodeOnly) {
|
||||||
|
Reference in New Issue
Block a user