"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "CPP/7zip/UI/Common/Bench.cpp" between
p7zip_15.14.1_src_all.tar.gz and p7zip_16.02_src_all.tar.gz

About: p7zip is a command-line file archiver with a high compression ratio (a port of the Windows program 7za.exe).

Bench.cpp  (p7zip_15.14.1_src_all):Bench.cpp  (p7zip_16.02_src_all)
skipping to change at line 863 skipping to change at line 863
uncompressedDataPtr = rg.Buffer; uncompressedDataPtr = rg.Buffer;
} }
if (_encoderFilter) if (_encoderFilter)
{ {
if (!rgCopy.Alloc(kBufferSize)) if (!rgCopy.Alloc(kBufferSize))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
outStreamSpec = new CBenchmarkOutStream; outStreamSpec = new CBenchmarkOutStream;
outStream = outStreamSpec;
if (!outStreamSpec->Alloc(kCompressedBufferSize)) if (!outStreamSpec->Alloc(kCompressedBufferSize))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
outStream = outStreamSpec;
propStreamSpec = 0; propStreamSpec = 0;
if (!propStream) if (!propStream)
{ {
propStreamSpec = new CBenchmarkOutStream; propStreamSpec = new CBenchmarkOutStream;
propStream = propStreamSpec; propStream = propStreamSpec;
} }
if (!propStreamSpec->Alloc(kMaxLzmaPropSize)) if (!propStreamSpec->Alloc(kMaxLzmaPropSize))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
propStreamSpec->Init(true, false); propStreamSpec->Init(true, false);
skipping to change at line 913 skipping to change at line 912
{ {
CMyComPtr<ICryptoSetPassword> sp; CMyComPtr<ICryptoSetPassword> sp;
coder.QueryInterface(IID_ICryptoSetPassword, &sp); coder.QueryInterface(IID_ICryptoSetPassword, &sp);
if (sp) if (sp)
{ {
RINOK(sp->CryptoSetPassword(_psw, sizeof(_psw))); RINOK(sp->CryptoSetPassword(_psw, sizeof(_psw)));
// we must call encoding one time to calculate password key for key cach e. // we must call encoding one time to calculate password key for key cach e.
// it must be after WriteCoderProperties! // it must be after WriteCoderProperties!
CBenchmarkInStream *inStreamSpec = new CBenchmarkInStream;
CMyComPtr<ISequentialInStream> inStream = inStreamSpec;
Byte temp[16]; Byte temp[16];
memset(temp, 0, sizeof(temp)); memset(temp, 0, sizeof(temp));
inStreamSpec->Init(temp, sizeof(temp));
CCrcOutStream *outStreamSpec = new CCrcOutStream;
CMyComPtr<ISequentialOutStream> outStream = outStreamSpec;
outStreamSpec->Init();
if (_encoderFilter) if (_encoderFilter)
{ {
_encoderFilter->Init(); _encoderFilter->Init();
_encoderFilter->Filter(temp, sizeof(temp)); _encoderFilter->Filter(temp, sizeof(temp));
} }
else else
{ {
RINOK(_encoder->Code(inStream, outStream, 0, 0, NULL)); CBenchmarkInStream *inStreamSpec = new CBenchmarkInStream;
CMyComPtr<ISequentialInStream> inStream = inStreamSpec;
inStreamSpec->Init(temp, sizeof(temp));
CCrcOutStream *crcStreamSpec = new CCrcOutStream;
CMyComPtr<ISequentialOutStream> crcStream = crcStreamSpec;
crcStreamSpec->Init();
RINOK(_encoder->Code(inStream, crcStream, 0, 0, NULL));
} }
} }
} }
} }
return S_OK; return S_OK;
} }
static void My_FilterBench(ICompressFilter *filter, Byte *data, size_t size) static void My_FilterBench(ICompressFilter *filter, Byte *data, size_t size)
{ {
skipping to change at line 1727 skipping to change at line 1727
void SetSum(const CTotalBenchRes &r1, const CTotalBenchRes &r2) void SetSum(const CTotalBenchRes &r1, const CTotalBenchRes &r2)
{ {
Rating = (r1.Rating + r2.Rating); Rating = (r1.Rating + r2.Rating);
Usage = (r1.Usage + r2.Usage); Usage = (r1.Usage + r2.Usage);
RPU = (r1.RPU + r2.RPU); RPU = (r1.RPU + r2.RPU);
// NumIterations1 = (r1.NumIterations1 + r2.NumIterations1); // NumIterations1 = (r1.NumIterations1 + r2.NumIterations1);
NumIterations2 = (r1.NumIterations2 + r2.NumIterations2); NumIterations2 = (r1.NumIterations2 + r2.NumIterations2);
} }
}; };
static void PrintNumber(IBenchPrintCallback &f, UInt64 value, int size) static void PrintNumber(IBenchPrintCallback &f, UInt64 value, unsigned size)
{ {
char s[128]; char s[128];
int startPos = (int)sizeof(s) - 32; unsigned startPos = (unsigned)sizeof(s) - 32;
memset(s, ' ', startPos); memset(s, ' ', startPos);
ConvertUInt64ToString(value, s + startPos); ConvertUInt64ToString(value, s + startPos);
// if (withSpace) // if (withSpace)
{ {
startPos--; startPos--;
size++; size++;
} }
int len = (int)strlen(s + startPos); unsigned len = (unsigned)strlen(s + startPos);
if (size > len) if (size > len)
{ {
startPos -= (size - len); startPos -= (size - len);
if (startPos < 0) if (startPos < 0)
startPos = 0; startPos = 0;
} }
f.Print(s + startPos); f.Print(s + startPos);
} }
static const int kFieldSize_Name = 12; static const unsigned kFieldSize_Name = 12;
static const int kFieldSize_SmallName = 4; static const unsigned kFieldSize_SmallName = 4;
static const int kFieldSize_Speed = 9; static const unsigned kFieldSize_Speed = 9;
static const int kFieldSize_Usage = 5; static const unsigned kFieldSize_Usage = 5;
static const int kFieldSize_RU = 6; static const unsigned kFieldSize_RU = 6;
static const int kFieldSize_Rating = 6; static const unsigned kFieldSize_Rating = 6;
static const int kFieldSize_EU = 5; static const unsigned kFieldSize_EU = 5;
static const int kFieldSize_Effec = 5; static const unsigned kFieldSize_Effec = 5;
static const int kFieldSize_TotalSize = 4 + kFieldSize_Speed + kFieldSize_Usage static const unsigned kFieldSize_TotalSize = 4 + kFieldSize_Speed + kFieldSize_U
+ kFieldSize_RU + kFieldSize_Rating; sage + kFieldSize_RU + kFieldSize_Rating;
static const int kFieldSize_EUAndEffec = 2 + kFieldSize_EU + kFieldSize_Effec; static const unsigned kFieldSize_EUAndEffec = 2 + kFieldSize_EU + kFieldSize_Eff
ec;
static void PrintRating(IBenchPrintCallback &f, UInt64 rating, int size) static void PrintRating(IBenchPrintCallback &f, UInt64 rating, unsigned size)
{ {
PrintNumber(f, (rating + 500000) / 1000000, size); PrintNumber(f, (rating + 500000) / 1000000, size);
} }
static void PrintPercents(IBenchPrintCallback &f, UInt64 val, UInt64 divider, in t size) static void PrintPercents(IBenchPrintCallback &f, UInt64 val, UInt64 divider, un signed size)
{ {
PrintNumber(f, (val * 100 + divider / 2) / divider, size); PrintNumber(f, (val * 100 + divider / 2) / divider, size);
} }
static void PrintChars(IBenchPrintCallback &f, char c, unsigned size) static void PrintChars(IBenchPrintCallback &f, char c, unsigned size)
{ {
char s[256]; char s[256];
memset(s, (Byte)c, size); memset(s, (Byte)c, size);
s[size] = 0; s[size] = 0;
f.Print(s); f.Print(s);
skipping to change at line 1867 skipping to change at line 1867
struct CBenchCallbackToPrint: public IBenchCallback struct CBenchCallbackToPrint: public IBenchCallback
{ {
CBenchProps BenchProps; CBenchProps BenchProps;
CTotalBenchRes EncodeRes; CTotalBenchRes EncodeRes;
CTotalBenchRes DecodeRes; CTotalBenchRes DecodeRes;
IBenchPrintCallback *_file; IBenchPrintCallback *_file;
UInt32 DictSize; UInt32 DictSize;
bool Use2Columns; bool Use2Columns;
int NameFieldSize; unsigned NameFieldSize;
bool ShowFreq; bool ShowFreq;
UInt64 CpuFreq; UInt64 CpuFreq;
unsigned EncodeWeight; unsigned EncodeWeight;
unsigned DecodeWeight; unsigned DecodeWeight;
CBenchCallbackToPrint(): CBenchCallbackToPrint():
Use2Columns(false), Use2Columns(false),
NameFieldSize(0), NameFieldSize(0),
skipping to change at line 2371 skipping to change at line 2371
if (!fullNameIsAvail) if (!fullNameIsAvail)
{ {
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
PrintCpuChars(s, c.vendor[i]); PrintCpuChars(s, c.vendor[i]);
} }
else else
{ {
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
UInt32 c[4] = { 0 }; UInt32 d[4] = { 0 };
MyCPUID(0x80000002 + i, &c[0], &c[1], &c[2], &c[3]); MyCPUID(0x80000002 + i, &d[0], &d[1], &d[2], &d[3]);
for (int j = 0; j < 4; j++) for (int j = 0; j < 4; j++)
PrintCpuChars(s, c[j]); PrintCpuChars(s, d[j]);
} }
} }
s.Add_Space_if_NotEmpty(); s.Add_Space_if_NotEmpty();
{ {
char temp[32]; char temp[32];
ConvertUInt32ToHex(c.ver, temp); ConvertUInt32ToHex(c.ver, temp);
s += '('; s += '(';
s += temp; s += temp;
s += ')'; s += ')';
skipping to change at line 2450 skipping to change at line 2450
UInt32 numThreadsSpecified = numCPUs; UInt32 numThreadsSpecified = numCPUs;
UInt32 testTime = kComplexInSeconds; UInt32 testTime = kComplexInSeconds;
UInt64 specifiedFreq = 0; UInt64 specifiedFreq = 0;
bool multiThreadTests = false; bool multiThreadTests = false;
COneMethodInfo method; COneMethodInfo method;
unsigned i;
CBenchBuffer fileDataBuffer; CBenchBuffer fileDataBuffer;
{
unsigned i;
for (i = 0; i < props.Size(); i++) for (i = 0; i < props.Size(); i++)
{ {
const CProperty &property = props[i]; const CProperty &property = props[i];
UString name = property.Name; UString name = property.Name;
name.MakeLower_Ascii(); name.MakeLower_Ascii();
if (name.IsEqualTo("file")) if (name.IsEqualTo("file"))
{ {
if (property.Value.IsEmpty()) if (property.Value.IsEmpty())
return E_INVALIDARG; return E_INVALIDARG;
skipping to change at line 2549 skipping to change at line 2550
} }
} }
#ifndef _7ZIP_ST #ifndef _7ZIP_ST
RINOK(ParseMtProp(s, propVariant, numCPUs, numThreadsSpecified)); RINOK(ParseMtProp(s, propVariant, numCPUs, numThreadsSpecified));
#endif #endif
continue; continue;
} }
RINOK(method.ParseMethodFromPROPVARIANT(name, propVariant)); RINOK(method.ParseMethodFromPROPVARIANT(name, propVariant));
} }
}
if (printCallback) if (printCallback)
{ {
AString s; AString s;
GetCpuName(s); GetCpuName(s);
printCallback->Print(s); printCallback->Print(s);
printCallback->NewLine(); printCallback->NewLine();
} }
if (printCallback) if (printCallback)
skipping to change at line 2690 skipping to change at line 2692
complexity = h.Complex; complexity = h.Complex;
checkSum = &h.CheckSum; checkSum = &h.CheckSum;
if (method.PropsString.IsEqualTo_Ascii_NoCase(hProp)) if (method.PropsString.IsEqualTo_Ascii_NoCase(hProp))
break; break;
} }
} }
} }
f.NewLine(); f.NewLine();
f.Print("Size"); f.Print("Size");
const int kFieldSize_CrcSpeed = 6; const unsigned kFieldSize_CrcSpeed = 6;
unsigned numThreadsTests = 0; unsigned numThreadsTests = 0;
for (;;) for (;;)
{ {
UInt32 t = GetNumThreadsNext(numThreadsTests, numThreadsSpecified); UInt32 t = GetNumThreadsNext(numThreadsTests, numThreadsSpecified);
PrintNumber(f, t, kFieldSize_CrcSpeed); PrintNumber(f, t, kFieldSize_CrcSpeed);
numThreadsTests++; numThreadsTests++;
if (t >= numThreadsSpecified) if (t >= numThreadsSpecified)
break; break;
} }
f.NewLine(); f.NewLine();
skipping to change at line 2853 skipping to change at line 2855
callback.Use2Columns = use2Columns; callback.Use2Columns = use2Columns;
bool showFreq = false; bool showFreq = false;
UInt64 cpuFreq = 0; UInt64 cpuFreq = 0;
if (totalBenchMode) if (totalBenchMode)
{ {
showFreq = true; showFreq = true;
} }
int fileldSize = kFieldSize_TotalSize; unsigned fileldSize = kFieldSize_TotalSize;
if (showFreq) if (showFreq)
fileldSize += kFieldSize_EUAndEffec; fileldSize += kFieldSize_EUAndEffec;
if (use2Columns) if (use2Columns)
{ {
PrintSpaces(f, callback.NameFieldSize); PrintSpaces(f, callback.NameFieldSize);
PrintRight(f, "Compressing", fileldSize); PrintRight(f, "Compressing", fileldSize);
f.Print(kSep); f.Print(kSep);
PrintRight(f, "Decompressing", fileldSize); PrintRight(f, "Decompressing", fileldSize);
} }
skipping to change at line 2920 skipping to change at line 2922
cpuFreq = specifiedFreq; cpuFreq = specifiedFreq;
if (totalBenchMode) if (totalBenchMode)
{ {
for (UInt32 i = 0; i < numIterations; i++) for (UInt32 i = 0; i < numIterations; i++)
{ {
if (i != 0) if (i != 0)
printCallback->NewLine(); printCallback->NewLine();
HRESULT res; HRESULT res;
int freqTest; const unsigned kNumCpuTests = 3;
const int kNumCpuTests = 3; for (unsigned freqTest = 0; freqTest < kNumCpuTests; freqTest++)
for (freqTest = 0; freqTest < kNumCpuTests; freqTest++)
{ {
PrintLeft(f, "CPU", kFieldSize_Name); PrintLeft(f, "CPU", kFieldSize_Name);
UInt32 resVal; UInt32 resVal;
RINOK(FreqBench(complexInCommands, numThreads, printCallback, RINOK(FreqBench(complexInCommands, numThreads, printCallback,
(freqTest == kNumCpuTests - 1 || specifiedFreq != 0), // showFreq (freqTest == kNumCpuTests - 1 || specifiedFreq != 0), // showFreq
specifiedFreq, specifiedFreq,
cpuFreq, resVal)); cpuFreq, resVal));
callback.NewLine(); callback.NewLine();
if (specifiedFreq != 0) if (specifiedFreq != 0)
skipping to change at line 2992 skipping to change at line 2993
callback.BenchProps.DecComplexCompr = h.DecComplexCompr; callback.BenchProps.DecComplexCompr = h.DecComplexCompr;
callback.BenchProps.DecComplexUnc = h.DecComplexUnc;; callback.BenchProps.DecComplexUnc = h.DecComplexUnc;;
needSetComplexity = false; needSetComplexity = false;
break; break;
} }
} }
} }
if (needSetComplexity) if (needSetComplexity)
callback.BenchProps.SetLzmaCompexity(); callback.BenchProps.SetLzmaCompexity();
for (i = 0; i < numIterations; i++) for (unsigned i = 0; i < numIterations; i++)
{ {
const unsigned kStartDicLog = 22; const unsigned kStartDicLog = 22;
unsigned pow = (dict < ((UInt32)1 << kStartDicLog)) ? kBenchMinDicLogSize : kStartDicLog; unsigned pow = (dict < ((UInt32)1 << kStartDicLog)) ? kBenchMinDicLogSize : kStartDicLog;
if (!multiDict) if (!multiDict)
pow = 31; pow = 31;
while (((UInt32)1 << pow) > dict && pow > 0) while (((UInt32)1 << pow) > dict && pow > 0)
pow--; pow--;
for (; ((UInt32)1 << pow) <= dict; pow++) for (; ((UInt32)1 << pow) <= dict; pow++)
{ {
char s[16]; char s[16];
 End of changes. 22 change blocks. 
37 lines changed or deleted 39 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS