xref: /aosp_15_r20/external/lz4/programs/bench.h (revision 27162e4e17433d5aa7cb38e7b6a433a09405fc7f)
1 /*
2     bench.h - Demo program to benchmark open-source compression algorithm
3     Copyright (C) Yann Collet 2012-2020
4 
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9 
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14 
15     You should have received a copy of the GNU General Public License along
16     with this program; if not, write to the Free Software Foundation, Inc.,
17     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 
19     You can contact the author at :
20     - LZ4 source repository : https://github.com/lz4/lz4
21     - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c
22 */
23 #ifndef BENCH_H_125623623633
24 #define BENCH_H_125623623633
25 
26 #include <stddef.h>
27 
28 /* BMK_benchFiles() :
29  * Benchmark all files provided through array @fileNamesTable.
30  * All files must be valid, otherwise benchmark fails.
31  * Roundtrip measurements are done for each file individually, but
32  * unless BMK_setBenchSeparately() is set, all results are agglomerated.
33  * The method benchmarks all compression levels from @cLevelStart to @cLevelLast,
34  * both inclusive, providing one result per compression level.
35  * If @cLevelLast <= @cLevelStart, BMK_benchFiles() benchmarks @cLevelStart only.
36  * @dictFileName is optional, it's possible to provide NULL.
37  * When provided, compression and decompression use the specified file as dictionary.
38  * Only one dictionary can be provided, in which case it's applied to all benchmarked files.
39 **/
40 int BMK_benchFiles(const char** fileNamesTable, unsigned nbFiles,
41                    int cLevelStart, int cLevelLast,
42                    const char* dictFileName);
43 
44 /* Set Parameters */
45 void BMK_setNbSeconds(unsigned nbSeconds);  /* minimum benchmark duration, in seconds, for both compression and decompression */
46 void BMK_setBlockSize(size_t blockSize);    /* Internally cut input file(s) into independent blocks of specified size */
47 void BMK_setNotificationLevel(unsigned level);  /* Influence verbosity level */
48 void BMK_setBenchSeparately(int separate);  /* When providing multiple files, output one result per file */
49 void BMK_setDecodeOnlyMode(int set);        /* v1.9.4+: set benchmark mode to decode only */
50 void BMK_skipChecksums(int skip);           /* v1.9.4+: only useful for DecodeOnlyMode; do not calculate checksum when present, to save CPU time */
51 
52 void BMK_setAdditionalParam(int additionalParam); /* hidden param, influence output format, for python parsing */
53 
54 #endif   /* BENCH_H_125623623633 */
55