|
Rizin
unix-like reverse engineering framework and cli tools
|
#include "platform.h"#include "util.h"#include <stdlib.h>#include <string.h>#include <stdio.h>#include <time.h>#include <assert.h>#include "datagen.h"#include "xxhash.h"#include "bench.h"#include "lz4.h"#include "lz4hc.h"Go to the source code of this file.
Classes | |
| struct | compressionParameters |
| struct | blockParam_t |
Macros | |
| #define | LZ4_STATIC_LINKING_ONLY |
| #define | LZ4_HC_STATIC_LINKING_ONLY |
| #define | LZ4_isError(errcode) (errcode==0) |
| #define | LZ4_GIT_COMMIT_STRING "" |
| #define | NBSECONDS 3 |
| #define | TIMELOOP_MICROSEC 1*1000000ULL /* 1 second */ |
| #define | TIMELOOP_NANOSEC 1*1000000000ULL /* 1 second */ |
| #define | ACTIVEPERIOD_MICROSEC 70*1000000ULL /* 70 seconds */ |
| #define | COOLPERIOD_SEC 10 |
| #define | DECOMP_MULT 1 /* test decompression DECOMP_MULT times longer than compression */ |
| #define | KB *(1 <<10) |
| #define | MB *(1 <<20) |
| #define | GB *(1U<<30) |
| #define | LZ4_MAX_DICT_SIZE (64 KB) |
| #define | DISPLAY(...) fprintf(stderr, __VA_ARGS__) |
| #define | DISPLAYLEVEL(l, ...) if (g_displayLevel>=l) { DISPLAY(__VA_ARGS__); } |
| #define | DISPLAYUPDATE(l, ...) |
| #define | DEBUG 0 |
| #define | DEBUGOUTPUT(...) if (DEBUG) DISPLAY(__VA_ARGS__); |
| #define | EXM_THROW(error, ...) |
| #define | MIN(a, b) ((a)<(b) ? (a) : (b)) |
| #define | MAX(a, b) ((a)>(b) ? (a) : (b)) |
| #define | NB_MARKS 4 |
Functions | |
| static void | LZ4_compressInitNoStream (struct compressionParameters *pThis) |
| static void | LZ4_compressInitStream (struct compressionParameters *pThis) |
| static void | LZ4_compressInitStreamHC (struct compressionParameters *pThis) |
| static void | LZ4_compressResetNoStream (const struct compressionParameters *pThis) |
| static void | LZ4_compressResetStream (const struct compressionParameters *pThis) |
| static void | LZ4_compressResetStreamHC (const struct compressionParameters *pThis) |
| static int | LZ4_compressBlockNoStream (const struct compressionParameters *pThis, const char *src, char *dst, int srcSize, int dstSize) |
| static int | LZ4_compressBlockNoStreamHC (const struct compressionParameters *pThis, const char *src, char *dst, int srcSize, int dstSize) |
| static int | LZ4_compressBlockStream (const struct compressionParameters *pThis, const char *src, char *dst, int srcSize, int dstSize) |
| static int | LZ4_compressBlockStreamHC (const struct compressionParameters *pThis, const char *src, char *dst, int srcSize, int dstSize) |
| static void | LZ4_compressCleanupNoStream (const struct compressionParameters *pThis) |
| static void | LZ4_compressCleanupStream (const struct compressionParameters *pThis) |
| static void | LZ4_compressCleanupStreamHC (const struct compressionParameters *pThis) |
| static void | LZ4_buildCompressionParameters (struct compressionParameters *pParams, int cLevel, const char *dictBuf, int dictSize) |
| void | BMK_setNotificationLevel (unsigned level) |
| void | BMK_setAdditionalParam (int additionalParam) |
| void | BMK_setNbSeconds (unsigned nbSeconds) |
| void | BMK_setBlockSize (size_t blockSize) |
| void | BMK_setBenchSeparately (int separate) |
| static int | BMK_benchMem (const void *srcBuffer, size_t srcSize, const char *displayName, int cLevel, const size_t *fileSizes, U32 nbFiles, const char *dictBuf, int dictSize) |
| static size_t | BMK_findMaxMem (U64 requiredMem) |
| static void | BMK_benchCLevel (void *srcBuffer, size_t benchedSize, const char *displayName, int cLevel, int cLevelLast, const size_t *fileSizes, unsigned nbFiles, const char *dictBuf, int dictSize) |
| static void | BMK_loadFiles (void *buffer, size_t bufferSize, size_t *fileSizes, const char **fileNamesTable, unsigned nbFiles) |
| static void | BMK_benchFileTable (const char **fileNamesTable, unsigned nbFiles, int cLevel, int cLevelLast, const char *dictBuf, int dictSize) |
| static void | BMK_syntheticTest (int cLevel, int cLevelLast, double compressibility, const char *dictBuf, int dictSize) |
| int | BMK_benchFilesSeparately (const char **fileNamesTable, unsigned nbFiles, int cLevel, int cLevelLast, const char *dictBuf, int dictSize) |
| int | BMK_benchFiles (const char **fileNamesTable, unsigned nbFiles, int cLevel, int cLevelLast, const char *dictFileName) |
Variables | |
| static const size_t | maxMemory = (sizeof(size_t)==4) ? (2 GB - 64 MB) : (size_t)(1ULL << ((sizeof(size_t)*8)-31)) |
| static U32 | g_compressibilityDefault = 50 |
| static U32 | g_displayLevel = 2 |
| static const clock_t | refreshRate = CLOCKS_PER_SEC * 15 / 100 |
| static clock_t | g_time = 0 |
| static U32 | g_nbSeconds = NBSECONDS |
| static size_t | g_blockSize = 0 |
| int | g_additionalParam = 0 |
| int | g_benchSeparately = 0 |
| #define ACTIVEPERIOD_MICROSEC 70*1000000ULL /* 70 seconds */ |
| #define DISPLAYLEVEL | ( | l, | |
| ... | |||
| ) | if (g_displayLevel>=l) { DISPLAY(__VA_ARGS__); } |
| #define DISPLAYUPDATE | ( | l, | |
| ... | |||
| ) |
| #define EXM_THROW | ( | error, | |
| ... | |||
| ) |
| #define NB_MARKS 4 |
|
static |
Definition at line 552 of file bench.c.
References BMK_benchMem(), compressionParameters::cLevel, compressionParameters::dictBuf, compressionParameters::dictSize, DISPLAY, g_additionalParam, g_blockSize, g_displayLevel, g_nbSeconds, LZ4_GIT_COMMIT_STRING, LZ4_VERSION_STRING, and SET_REALTIME_PRIORITY.
Referenced by BMK_benchFileTable(), and BMK_syntheticTest().
| int BMK_benchFiles | ( | const char ** | fileNamesTable, |
| unsigned | nbFiles, | ||
| int | cLevel, | ||
| int | cLevelLast, | ||
| const char * | dictFileName | ||
| ) |
Definition at line 697 of file bench.c.
References BMK_benchFilesSeparately(), BMK_benchFileTable(), BMK_syntheticTest(), compressionParameters::cLevel, compressionParameters::dictBuf, compressionParameters::dictSize, DISPLAYLEVEL, EXM_THROW, benchmark::FILE, free(), g_benchSeparately, g_compressibilityDefault, int, LZ4_MAX_DICT_SIZE, LZ4HC_CLEVEL_MAX, malloc(), NULL, SEEK_SET, UTIL_fseek, and UTIL_getFileSize().
Referenced by main().
| int BMK_benchFilesSeparately | ( | const char ** | fileNamesTable, |
| unsigned | nbFiles, | ||
| int | cLevel, | ||
| int | cLevelLast, | ||
| const char * | dictBuf, | ||
| int | dictSize | ||
| ) |
Definition at line 680 of file bench.c.
References BMK_benchFileTable(), compressionParameters::cLevel, compressionParameters::dictBuf, compressionParameters::dictSize, DISPLAYLEVEL, and LZ4HC_CLEVEL_MAX.
Referenced by BMK_benchFiles().
|
static |
Definition at line 614 of file bench.c.
References BMK_benchCLevel(), BMK_findMaxMem(), BMK_loadFiles(), compressionParameters::cLevel, compressionParameters::dictBuf, compressionParameters::dictSize, DISPLAY, EXM_THROW, free(), LZ4_MAX_INPUT_SIZE, malloc(), snprintf, and UTIL_getTotalFileSize().
Referenced by BMK_benchFiles(), and BMK_benchFilesSeparately().
|
static |
Definition at line 319 of file bench.c.
References ACTIVEPERIOD_MICROSEC, assert(), compressionParameters::blockFunction, compressionParameters::cleanupFunction, compressionParameters::cLevel, COOLPERIOD_SEC, blockParam_t::cPtr, blockParam_t::cRoom, blockParam_t::cSize, DECOMP_MULT, compressionParameters::dictBuf, compressionParameters::dictSize, DISPLAY, DISPLAYLEVEL, EXM_THROW, free(), g_additionalParam, g_blockSize, g_displayLevel, g_nbSeconds, compressionParameters::initFunction, int, KB, LZ4_buildCompressionParameters(), LZ4_compressBound(), LZ4_decompress_safe_usingDict(), LZ4_isError, malloc(), MB, memset(), MIN, NB_MARKS, pos, RDG_genBuffer(), compressionParameters::resetFunction, blockParam_t::resPtr, blockParam_t::resSize, blockParam_t::srcPtr, srcSize, blockParam_t::srcSize, TIMELOOP_NANOSEC, U32, U64, UTIL_clockSpanMicro(), UTIL_clockSpanNano(), UTIL_getTime(), UTIL_sleep, UTIL_sleepMilli, UTIL_waitForNextTick(), and XXH64().
Referenced by BMK_benchCLevel().
|
static |
BMK_loadFiles() : Loads buffer with content of files listed within fileNamesTable. At most, fills buffer entirely
Definition at line 582 of file bench.c.
References DISPLAYLEVEL, DISPLAYUPDATE, EXM_THROW, f, benchmark::FILE, n, NULL, pos, UTIL_getFileSize(), and UTIL_isDirectory().
Referenced by BMK_benchFileTable().
| void BMK_setAdditionalParam | ( | int | additionalParam | ) |
| void BMK_setBenchSeparately | ( | int | separate | ) |
| void BMK_setBlockSize | ( | size_t | blockSize | ) |
| void BMK_setNbSeconds | ( | unsigned | nbSeconds | ) |
Definition at line 292 of file bench.c.
References DISPLAYLEVEL, and g_nbSeconds.
Referenced by main().
| void BMK_setNotificationLevel | ( | unsigned | level | ) |
|
static |
Definition at line 658 of file bench.c.
References BMK_benchCLevel(), compressionParameters::cLevel, compressionParameters::dictBuf, compressionParameters::dictSize, EXM_THROW, free(), malloc(), RDG_genBuffer(), and snprintf.
Referenced by BMK_benchFiles().
|
static |
Definition at line 185 of file bench.c.
References compressionParameters::blockFunction, compressionParameters::cleanupFunction, compressionParameters::cLevel, compressionParameters::dictBuf, compressionParameters::dictSize, compressionParameters::initFunction, LZ4_compressBlockNoStream(), LZ4_compressBlockNoStreamHC(), LZ4_compressBlockStream(), LZ4_compressBlockStreamHC(), LZ4_compressCleanupNoStream(), LZ4_compressCleanupStream(), LZ4_compressCleanupStreamHC(), LZ4_compressInitNoStream(), LZ4_compressInitStream(), LZ4_compressInitStreamHC(), LZ4_compressResetNoStream(), LZ4_compressResetStream(), LZ4_compressResetStreamHC(), LZ4HC_CLEVEL_MIN, and compressionParameters::resetFunction.
Referenced by BMK_benchMem().
|
static |
Definition at line 131 of file bench.c.
References compressionParameters::cLevel, dst, LZ4_compress_fast(), src, and srcSize.
Referenced by LZ4_buildCompressionParameters().
|
static |
Definition at line 140 of file bench.c.
References compressionParameters::cLevel, dst, LZ4_compress_HC(), src, and srcSize.
Referenced by LZ4_buildCompressionParameters().
|
static |
Definition at line 148 of file bench.c.
References compressionParameters::cLevel, dst, LZ4_compress_fast_continue(), compressionParameters::LZ4_stream, src, and srcSize.
Referenced by LZ4_buildCompressionParameters().
|
static |
Definition at line 157 of file bench.c.
References dst, LZ4_compress_HC_continue(), compressionParameters::LZ4_streamHC, src, and srcSize.
Referenced by LZ4_buildCompressionParameters().
|
static |
Definition at line 165 of file bench.c.
Referenced by LZ4_buildCompressionParameters().
|
static |
Definition at line 171 of file bench.c.
References compressionParameters::LZ4_dictStream, LZ4_freeStream(), and compressionParameters::LZ4_stream.
Referenced by LZ4_buildCompressionParameters().
|
static |
Definition at line 178 of file bench.c.
References compressionParameters::LZ4_dictStreamHC, LZ4_freeStreamHC(), and compressionParameters::LZ4_streamHC.
Referenced by LZ4_buildCompressionParameters().
|
static |
Definition at line 82 of file bench.c.
References compressionParameters::LZ4_dictStream, compressionParameters::LZ4_dictStreamHC, compressionParameters::LZ4_stream, compressionParameters::LZ4_streamHC, and NULL.
Referenced by LZ4_buildCompressionParameters().
|
static |
Definition at line 91 of file bench.c.
References compressionParameters::dictBuf, compressionParameters::dictSize, LZ4_createStream(), compressionParameters::LZ4_dictStream, compressionParameters::LZ4_dictStreamHC, LZ4_loadDict(), compressionParameters::LZ4_stream, compressionParameters::LZ4_streamHC, and NULL.
Referenced by LZ4_buildCompressionParameters().
|
static |
Definition at line 101 of file bench.c.
References compressionParameters::dictBuf, compressionParameters::dictSize, LZ4_createStreamHC(), compressionParameters::LZ4_dictStream, compressionParameters::LZ4_dictStreamHC, LZ4_loadDictHC(), compressionParameters::LZ4_stream, compressionParameters::LZ4_streamHC, and NULL.
Referenced by LZ4_buildCompressionParameters().
|
static |
Definition at line 111 of file bench.c.
Referenced by LZ4_buildCompressionParameters().
|
static |
Definition at line 117 of file bench.c.
References LZ4_attach_dictionary(), compressionParameters::LZ4_dictStream, LZ4_resetStream_fast(), and compressionParameters::LZ4_stream.
Referenced by LZ4_buildCompressionParameters().
|
static |
Definition at line 124 of file bench.c.
References compressionParameters::cLevel, LZ4_attach_HC_dictionary(), compressionParameters::LZ4_dictStreamHC, LZ4_resetStreamHC_fast(), and compressionParameters::LZ4_streamHC.
Referenced by LZ4_buildCompressionParameters().
| int g_additionalParam = 0 |
Definition at line 285 of file bench.c.
Referenced by BMK_benchCLevel(), BMK_benchMem(), and BMK_setAdditionalParam().
| int g_benchSeparately = 0 |
Definition at line 286 of file bench.c.
Referenced by BMK_benchFiles(), and BMK_setBenchSeparately().
|
static |
Definition at line 284 of file bench.c.
Referenced by BMK_benchCLevel(), BMK_benchMem(), and BMK_setBlockSize().
|
static |
Definition at line 245 of file bench.c.
Referenced by BMK_benchFiles().
|
static |
Definition at line 253 of file bench.c.
Referenced by BMK_benchCLevel(), BMK_benchMem(), and BMK_setNotificationLevel().
Definition at line 283 of file bench.c.
Referenced by BMK_benchCLevel(), BMK_benchMem(), and BMK_setNbSeconds().
|
static |
Definition at line 260 of file bench.c.
Referenced by FUZ_displayUpdate().
|
static |
Definition at line 243 of file bench.c.
Referenced by BMK_findMaxMem().