Upload 2.0.2
[physicsfs] / lzma / CPP / 7zip / Compress / LZMA_Alone / LzmaBench.h
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
12 struct 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
24 struct IBenchCallback
25 {
26   virtual HRESULT SetEncodeResult(const CBenchInfo &info, bool final) = 0;
27   virtual HRESULT SetDecodeResult(const CBenchInfo &info, bool final) = 0;
28 };
29
30 UInt64 GetUsage(const CBenchInfo &benchOnfo);
31 UInt64 GetRatingPerUsage(const CBenchInfo &info, UInt64 rating);
32 UInt64 GetCompressRating(UInt32 dictionarySize, UInt64 elapsedTime, UInt64 freq, UInt64 size);
33 UInt64 GetDecompressRating(UInt64 elapsedTime, UInt64 freq, UInt64 outSize, UInt64 inSize, UInt32 numIterations);
34
35 HRESULT LzmaBench(
36   #ifdef EXTERNAL_LZMA
37   CCodecs *codecs,
38   #endif
39   UInt32 numThreads, UInt32 dictionarySize, IBenchCallback *callback);
40
41 const int kBenchMinDicLogSize = 18;
42
43 UInt64 GetBenchMemoryUsage(UInt32 numThreads, UInt32 dictionary);
44
45 bool CrcInternalTest();
46 HRESULT CrcBench(UInt32 numThreads, UInt32 bufferSize, UInt64 &speed);
47
48 #endif