Update to 7-Zip Version 21.03

This commit is contained in:
Tino Reichardt
2021-08-25 22:33:02 +02:00
parent 27d965fd99
commit df06f31a42
90 changed files with 6003 additions and 1882 deletions

View File

@@ -1405,11 +1405,13 @@ void CArcCmdLineParser::Parse2(CArcCmdLineOptions &options)
else if (options.Command.CommandType == NCommandType::kBenchmark)
{
options.NumIterations = 1;
options.NumIterations_Defined = false;
if (curCommandIndex < numNonSwitchStrings)
{
if (!StringToUInt32(nonSwitchStrings[curCommandIndex], options.NumIterations))
throw CArcCmdLineException("Incorrect number of benchmark iterations", nonSwitchStrings[curCommandIndex]);
curCommandIndex++;
options.NumIterations_Defined = true;
}
}
else if (options.Command.CommandType == NCommandType::kHash)

View File

@@ -109,6 +109,7 @@ struct CArcCmdLineOptions
// Benchmark
UInt32 NumIterations;
bool NumIterations_Defined;
CArcCmdLineOptions():
HelpMode(false),

View File

File diff suppressed because it is too large Load Diff

View File

@@ -8,6 +8,8 @@
#include "../../Common/CreateCoder.h"
#include "../../UI/Common/Property.h"
UInt64 Benchmark_GetUsage_Percents(UInt64 usage);
struct CBenchInfo
{
UInt64 GlobalTime;
@@ -17,26 +19,71 @@ struct CBenchInfo
UInt64 UnpackSize;
UInt64 PackSize;
UInt64 NumIterations;
/*
during Code(): we track benchInfo only from one thread (theads with index[0])
NumIterations means number of threads
UnpackSize and PackSize are total sizes of all iterations of current thread
after Code():
NumIterations means the number of Iterations
UnpackSize and PackSize are total sizes of all threads
*/
CBenchInfo(): NumIterations(0) {}
UInt64 GetUsage() const;
UInt64 GetRatingPerUsage(UInt64 rating) const;
UInt64 GetSpeed(UInt64 numCommands) const;
UInt64 GetSpeed(UInt64 numUnits) const;
UInt64 GetUnpackSizeSpeed() const { return GetSpeed(UnpackSize * NumIterations); }
UInt64 Get_UnpackSize_Full() const { return UnpackSize * NumIterations; }
UInt64 GetRating_LzmaEnc(UInt64 dictSize) const;
UInt64 GetRating_LzmaDec() const;
};
struct CTotalBenchRes
{
// UInt64 NumIterations1; // for Usage
UInt64 NumIterations2; // for Rating / RPU
UInt64 Rating;
UInt64 Usage;
UInt64 RPU;
UInt64 Speed;
void Init() { /* NumIterations1 = 0; */ NumIterations2 = 0; Rating = 0; Usage = 0; RPU = 0; Speed = 0; }
void SetSum(const CTotalBenchRes &r1, const CTotalBenchRes &r2)
{
Rating = (r1.Rating + r2.Rating);
Usage = (r1.Usage + r2.Usage);
RPU = (r1.RPU + r2.RPU);
Speed = (r1.Speed + r2.Speed);
// NumIterations1 = (r1.NumIterations1 + r2.NumIterations1);
NumIterations2 = (r1.NumIterations2 + r2.NumIterations2);
}
void Generate_From_BenchInfo(const CBenchInfo &info);
void Mult_For_Weight(unsigned weight);
void Update_With_Res(const CTotalBenchRes &r);
};
struct IBenchCallback
{
virtual HRESULT SetFreq(bool showFreq, UInt64 cpuFreq) = 0;
// virtual HRESULT SetFreq(bool showFreq, UInt64 cpuFreq) = 0;
virtual HRESULT SetEncodeResult(const CBenchInfo &info, bool final) = 0;
virtual HRESULT SetDecodeResult(const CBenchInfo &info, bool final) = 0;
};
UInt64 GetCompressRating(UInt32 dictSize, UInt64 elapsedTime, UInt64 freq, UInt64 size);
UInt64 GetDecompressRating(UInt64 elapsedTime, UInt64 freq, UInt64 outSize, UInt64 inSize, UInt64 numIterations);
const unsigned kBenchMinDicLogSize = 18;
UInt64 GetBenchMemoryUsage(UInt32 numThreads, UInt32 dictionary, bool totalBench = false);
UInt64 GetBenchMemoryUsage(UInt32 numThreads, int level, UInt64 dictionary, bool totalBench);
struct IBenchPrintCallback
{
@@ -45,22 +92,20 @@ struct IBenchPrintCallback
virtual HRESULT CheckBreak() = 0;
};
/*
struct IBenchFreqCallback
{
virtual void AddCpuFreq(UInt64 freq) = 0;
virtual HRESULT AddCpuFreq(unsigned numThreads, UInt64 freq, UInt64 usage) = 0;
virtual HRESULT FreqsFinished(unsigned numThreads) = 0;
};
*/
HRESULT Bench(
DECL_EXTERNAL_CODECS_LOC_VARS
IBenchPrintCallback *printCallback,
IBenchCallback *benchCallback,
// IBenchFreqCallback *freqCallback,
const CObjectVector<CProperty> &props,
UInt32 numIterations,
bool multiDict
);
bool multiDict,
IBenchFreqCallback *freqCallback = NULL);
AString GetProcessThreadsInfo(const NWindows::NSystem::CProcessAffinity &ti);

View File

@@ -272,7 +272,11 @@ void Benchmark(bool totalMode)
prop.Value = "*";
props.Add(prop);
}
result = Benchmark(EXTERNAL_CODECS_VARS_L props, g_HWND);
result = Benchmark(
EXTERNAL_CODECS_VARS_L
props,
k_NumBenchIterations_Default,
g_HWND);
MY_TRY_FINISH
}