1// LzmaBench.h
2
3#ifndef __LZMABENCH_H
4#define __LZMABENCH_H
5
6#include <stdio.h>
7#include "../../../Common/Types.h"
8#ifdef EXTERNAL_LZMA
9#include "../../UI/Common/LoadCodecs.h"
10#endif
11
12struct CBenchInfo
13{
14  UInt64 GlobalTime;
15  UInt64 GlobalFreq;
16  UInt64 UserTime;
17  UInt64 UserFreq;
18  UInt64 UnpackSize;
19  UInt64 PackSize;
20  UInt32 NumIterations;
21  CBenchInfo(): NumIterations(0) {}
22};
23
24struct IBenchCallback
25{
26  virtual HRESULT SetEncodeResult(const CBenchInfo &info, bool final) = 0;
27  virtual HRESULT SetDecodeResult(const CBenchInfo &info, bool final) = 0;
28};
29
30UInt64 GetUsage(const CBenchInfo &benchOnfo);
31UInt64 GetRatingPerUsage(const CBenchInfo &info, UInt64 rating);
32UInt64 GetCompressRating(UInt32 dictionarySize, UInt64 elapsedTime, UInt64 freq, UInt64 size);
33UInt64 GetDecompressRating(UInt64 elapsedTime, UInt64 freq, UInt64 outSize, UInt64 inSize, UInt32 numIterations);
34
35HRESULT LzmaBench(
36  #ifdef EXTERNAL_LZMA
37  CCodecs *codecs,
38  #endif
39  UInt32 numThreads, UInt32 dictionarySize, IBenchCallback *callback);
40
41const int kBenchMinDicLogSize = 18;
42
43UInt64 GetBenchMemoryUsage(UInt32 numThreads, UInt32 dictionary);
44
45bool CrcInternalTest();
46HRESULT CrcBench(UInt32 numThreads, UInt32 bufferSize, UInt64 &speed);
47
48#endif
49