• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Bench.h
2 
3 #ifndef __7ZIP_BENCH_H
4 #define __7ZIP_BENCH_H
5 
6 #include "../../Common/CreateCoder.h"
7 #include "../../UI/Common/Property.h"
8 
9 struct CBenchInfo
10 {
11   UInt64 GlobalTime;
12   UInt64 GlobalFreq;
13   UInt64 UserTime;
14   UInt64 UserFreq;
15   UInt64 UnpackSize;
16   UInt64 PackSize;
17   UInt64 NumIterations;
18 
CBenchInfoCBenchInfo19   CBenchInfo(): NumIterations(0) {}
20   UInt64 GetUsage() const;
21   UInt64 GetRatingPerUsage(UInt64 rating) const;
22   UInt64 GetSpeed(UInt64 numCommands) const;
23 };
24 
25 struct IBenchCallback
26 {
27   virtual HRESULT SetFreq(bool showFreq, UInt64 cpuFreq) = 0;
28   virtual HRESULT SetEncodeResult(const CBenchInfo &info, bool final) = 0;
29   virtual HRESULT SetDecodeResult(const CBenchInfo &info, bool final) = 0;
30 };
31 
32 UInt64 GetCompressRating(UInt32 dictSize, UInt64 elapsedTime, UInt64 freq, UInt64 size);
33 UInt64 GetDecompressRating(UInt64 elapsedTime, UInt64 freq, UInt64 outSize, UInt64 inSize, UInt64 numIterations);
34 
35 const unsigned kBenchMinDicLogSize = 18;
36 
37 UInt64 GetBenchMemoryUsage(UInt32 numThreads, UInt32 dictionary, bool totalBench = false);
38 
39 struct IBenchPrintCallback
40 {
41   virtual void Print(const char *s) = 0;
42   virtual void NewLine() = 0;
43   virtual HRESULT CheckBreak() = 0;
44 };
45 
46 HRESULT Bench(
47     DECL_EXTERNAL_CODECS_LOC_VARS
48     IBenchPrintCallback *printCallback,
49     IBenchCallback *benchCallback,
50     const CObjectVector<CProperty> &props,
51     UInt32 numIterations,
52     bool multiDict
53     );
54 
55 #endif
56