LzmaBench.h 1.2 KB

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