mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-08 14:07:00 -06:00
23.01
This commit is contained in:
@@ -22,9 +22,7 @@
|
||||
|
||||
#include "../FileManager/DialogSize.h"
|
||||
#include "../FileManager/HelpUtils.h"
|
||||
#ifdef LANG
|
||||
#include "../FileManager/LangUtils.h"
|
||||
#endif
|
||||
|
||||
#include "../../MyVersion.h"
|
||||
|
||||
@@ -156,7 +154,7 @@ void CSyncData::Init()
|
||||
NeedPrint_Dec_1 =
|
||||
NeedPrint_Dec =
|
||||
NeedPrint_Tot = false;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
struct CBenchProgressSync
|
||||
@@ -243,7 +241,7 @@ class CBenchmarkDialog;
|
||||
struct CThreadBenchmark
|
||||
{
|
||||
CBenchmarkDialog *BenchmarkDialog;
|
||||
DECL_EXTERNAL_CODECS_LOC_VARS2;
|
||||
DECL_EXTERNAL_CODECS_LOC_VARS_DECL
|
||||
// HRESULT Result;
|
||||
|
||||
HRESULT Process();
|
||||
@@ -290,15 +288,15 @@ class CBenchmarkDialog:
|
||||
Sync.Init();
|
||||
}
|
||||
|
||||
virtual bool OnInit();
|
||||
virtual bool OnDestroy();
|
||||
virtual bool OnSize(WPARAM /* wParam */, int xSize, int ySize);
|
||||
virtual bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
virtual bool OnCommand(int code, int itemID, LPARAM lParam);
|
||||
virtual void OnHelp();
|
||||
virtual void OnCancel();
|
||||
virtual bool OnTimer(WPARAM timerID, LPARAM callback);
|
||||
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
|
||||
virtual bool OnInit() Z7_override;
|
||||
virtual bool OnDestroy() Z7_override;
|
||||
virtual bool OnSize(WPARAM /* wParam */, int xSize, int ySize) Z7_override;
|
||||
virtual bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam) Z7_override;
|
||||
virtual bool OnCommand(unsigned code, unsigned itemID, LPARAM lParam) Z7_override;
|
||||
virtual void OnHelp() Z7_override;
|
||||
virtual void OnCancel() Z7_override;
|
||||
virtual bool OnTimer(WPARAM timerID, LPARAM callback) Z7_override;
|
||||
virtual bool OnButtonClicked(unsigned buttonID, HWND buttonHWND) Z7_override;
|
||||
|
||||
void Disable_Stop_Button();
|
||||
void OnStopButton();
|
||||
@@ -315,7 +313,7 @@ class CBenchmarkDialog:
|
||||
UInt32 GetNumberOfThreads();
|
||||
size_t OnChangeDictionary();
|
||||
|
||||
void SetItemText_Number(int itemID, UInt64 val, LPCTSTR post = NULL);
|
||||
void SetItemText_Number(unsigned itemID, UInt64 val, LPCTSTR post = NULL);
|
||||
void Print_MemUsage(UString &s, UInt64 memUsage) const;
|
||||
bool IsMemoryUsageOK(UInt64 memUsage) const
|
||||
{ return memUsage + (1 << 20) <= RamSize_Limit; }
|
||||
@@ -347,17 +345,17 @@ public:
|
||||
TotalMode(false)
|
||||
{}
|
||||
|
||||
~CBenchmarkDialog();
|
||||
~CBenchmarkDialog() Z7_DESTRUCTOR_override;
|
||||
|
||||
bool PostMsg_Finish(LPARAM param)
|
||||
bool PostMsg_Finish(WPARAM wparam)
|
||||
{
|
||||
if ((HWND)*this)
|
||||
return PostMsg(k_Message_Finished, param);
|
||||
return PostMsg(k_Message_Finished, wparam);
|
||||
// the (HWND)*this is NULL only for some internal code failure
|
||||
return true;
|
||||
}
|
||||
|
||||
INT_PTR Create(HWND wndParent = 0)
|
||||
INT_PTR Create(HWND wndParent = NULL)
|
||||
{
|
||||
BIG_DIALOG_SIZE(332, 228);
|
||||
return CModalDialog::Create(TotalMode ? IDD_BENCH_TOTAL : SIZED_DIALOG(IDD_BENCH), wndParent);
|
||||
@@ -385,13 +383,13 @@ public:
|
||||
|
||||
UString HResultToMessage(HRESULT errorCode);
|
||||
|
||||
#ifdef LANG
|
||||
#ifdef Z7_LANG
|
||||
static const UInt32 kLangIDs[] =
|
||||
{
|
||||
IDT_BENCH_DICTIONARY,
|
||||
IDT_BENCH_MEMORY,
|
||||
IDT_BENCH_NUM_THREADS,
|
||||
IDT_BENCH_SPEED,
|
||||
IDT_BENCH_SIZE,
|
||||
IDT_BENCH_RATING_LABEL,
|
||||
IDT_BENCH_USAGE_LABEL,
|
||||
IDT_BENCH_RPU_LABEL,
|
||||
@@ -406,9 +404,9 @@ static const UInt32 kLangIDs[] =
|
||||
IDB_RESTART
|
||||
};
|
||||
|
||||
static const UInt32 kLangIDs_Colon[] =
|
||||
static const UInt32 kLangIDs_RemoveColon[] =
|
||||
{
|
||||
IDT_BENCH_SIZE
|
||||
IDT_BENCH_SPEED
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -439,18 +437,18 @@ static int ComboBox_Add_UInt32(NWindows::NControl::CComboBox &cb, UInt32 v)
|
||||
{
|
||||
TCHAR s[16];
|
||||
ConvertUInt32ToString(v, s);
|
||||
int index = (int)cb.AddString(s);
|
||||
cb.SetItemData(index, v);
|
||||
const int index = (int)cb.AddString(s);
|
||||
cb.SetItemData(index, (LPARAM)v);
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
bool CBenchmarkDialog::OnInit()
|
||||
{
|
||||
#ifdef LANG
|
||||
#ifdef Z7_LANG
|
||||
LangSetWindowText(*this, IDD_BENCH);
|
||||
LangSetDlgItems(*this, kLangIDs, ARRAY_SIZE(kLangIDs));
|
||||
// LangSetDlgItems_Colon(*this, kLangIDs_Colon, ARRAY_SIZE(kLangIDs_Colon));
|
||||
LangSetDlgItems(*this, kLangIDs, Z7_ARRAY_SIZE(kLangIDs));
|
||||
LangSetDlgItems_RemoveColon(*this, kLangIDs_RemoveColon, Z7_ARRAY_SIZE(kLangIDs_RemoveColon));
|
||||
LangSetDlgItemText(*this, IDT_BENCH_CURRENT2, IDT_BENCH_CURRENT);
|
||||
LangSetDlgItemText(*this, IDT_BENCH_RESULTING2, IDT_BENCH_RESULTING);
|
||||
#endif
|
||||
@@ -486,7 +484,7 @@ bool CBenchmarkDialog::OnInit()
|
||||
NSystem::CProcessAffinity threadsInfo;
|
||||
threadsInfo.InitST();
|
||||
|
||||
#ifndef _7ZIP_ST
|
||||
#ifndef Z7_ST
|
||||
if (threadsInfo.Get() && threadsInfo.processAffinityMask != 0)
|
||||
numCPUs = threadsInfo.GetNumProcessThreads();
|
||||
else
|
||||
@@ -531,7 +529,7 @@ bool CBenchmarkDialog::OnInit()
|
||||
if (numThreads == (UInt32)(Int32)-1)
|
||||
numThreads = numCPUs;
|
||||
if (numThreads > 1)
|
||||
numThreads &= ~1;
|
||||
numThreads &= ~(UInt32)1;
|
||||
const UInt32 kNumThreadsMax = (1 << 12);
|
||||
if (numThreads > kNumThreadsMax)
|
||||
numThreads = kNumThreadsMax;
|
||||
@@ -603,7 +601,7 @@ bool CBenchmarkDialog::OnInit()
|
||||
ConvertUInt32ToString(d, s);
|
||||
lstrcat(s, post);
|
||||
const int index = (int)m_Dictionary.AddString(s);
|
||||
m_Dictionary.SetItemData(index, dict);
|
||||
m_Dictionary.SetItemData(index, (LPARAM)dict);
|
||||
if (dict <= Sync.DictSize)
|
||||
cur = index;
|
||||
if (dict >= kMaxDicSize)
|
||||
@@ -711,18 +709,18 @@ UInt32 CBenchmarkDialog::GetNumberOfThreads()
|
||||
s[0] = (wchar_t)('0' + (val) / 100); \
|
||||
s[1] = (wchar_t)('0' + (val) % 100 / 10); \
|
||||
s[2] = (wchar_t)('0' + (val) % 10); \
|
||||
s[3] = 0; }
|
||||
s += 3; s[0] = 0; }
|
||||
|
||||
static void NumberToDot3(UInt64 val, WCHAR *s)
|
||||
static WCHAR *NumberToDot3(UInt64 val, WCHAR *s)
|
||||
{
|
||||
ConvertUInt64ToString(val / 1000, s);
|
||||
s = ConvertUInt64ToString(val / 1000, s);
|
||||
const UInt32 rem = (UInt32)(val % 1000);
|
||||
s += MyStringLen(s);
|
||||
*s++ = '.';
|
||||
UINT_TO_STR_3(s, rem);
|
||||
UINT_TO_STR_3(s, rem)
|
||||
return s;
|
||||
}
|
||||
|
||||
void CBenchmarkDialog::SetItemText_Number(int itemID, UInt64 val, LPCTSTR post)
|
||||
void CBenchmarkDialog::SetItemText_Number(unsigned itemID, UInt64 val, LPCTSTR post)
|
||||
{
|
||||
TCHAR s[64];
|
||||
ConvertUInt64ToString(val, s);
|
||||
@@ -758,7 +756,7 @@ size_t CBenchmarkDialog::OnChangeDictionary()
|
||||
UString s;
|
||||
Print_MemUsage(s, memUsage);
|
||||
|
||||
#ifdef _7ZIP_LARGE_PAGES
|
||||
#ifdef Z7_LARGE_PAGES
|
||||
{
|
||||
AString s2;
|
||||
Add_LargePages_String(s2);
|
||||
@@ -875,7 +873,7 @@ void CBenchmarkDialog::StartBenchmark()
|
||||
const UInt32 numThreads = GetNumberOfThreads();
|
||||
const UInt32 numPasses = (UInt32)m_NumPasses.GetItemData_of_CurSel();
|
||||
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(g_IDs); i++)
|
||||
for (unsigned i = 0; i < Z7_ARRAY_SIZE(g_IDs); i++)
|
||||
SetItemText(g_IDs[i], kProcessingString);
|
||||
|
||||
SetItemText_Empty(IDT_BENCH_LOG);
|
||||
@@ -916,7 +914,7 @@ void CBenchmarkDialog::StartBenchmark()
|
||||
{
|
||||
MyKillTimer();
|
||||
MessageBoxError_Status(L"Can't create thread");
|
||||
};
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1000,19 +998,17 @@ void CBenchmarkDialog::PrintTime()
|
||||
|
||||
WCHAR s[64];
|
||||
|
||||
// GetTimeString(elapsedTime / 1000, s);
|
||||
ConvertUInt32ToString(elapsedTime / 1000, s);
|
||||
WCHAR *p = ConvertUInt32ToString(elapsedTime / 1000, s);
|
||||
|
||||
if (_finishTime_WasSet)
|
||||
{
|
||||
WCHAR *p = s + MyStringLen(s);
|
||||
*p++ = '.';
|
||||
UINT_TO_STR_3(p, elapsedTime % 1000);
|
||||
UINT_TO_STR_3(p, elapsedTime % 1000)
|
||||
}
|
||||
|
||||
// NumberToDot3((UInt64)elapsedTime, s);
|
||||
// p = NumberToDot3((UInt64)elapsedTime, s);
|
||||
|
||||
wcscat(s, L" s");
|
||||
MyStringCopy(p, L" s");
|
||||
|
||||
// if (WasStopped_in_GUI) wcscat(s, L" X"); // for debug
|
||||
|
||||
@@ -1051,7 +1047,7 @@ static UInt32 GetRating(const CTotalBenchRes &info)
|
||||
if (rating32 != rating64)
|
||||
rating32 = (UInt32)(Int32)-1;
|
||||
return rating32;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
static void AddUsageString(UString &s, const CTotalBenchRes &info)
|
||||
@@ -1088,7 +1084,7 @@ static void AddRatingString(UString &s, const CTotalBenchRes &info)
|
||||
// s += " ";
|
||||
// s.Add_UInt32(GetRating(info));
|
||||
Add_Dot3String(s, GetRating(info));
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
static void AddRatingsLine(UString &s, const CTotalBenchRes &enc, const CTotalBenchRes &dec
|
||||
@@ -1127,8 +1123,7 @@ void CBenchmarkDialog::PrintRating(UInt64 rating, UINT controlID)
|
||||
{
|
||||
// SetItemText_Number(controlID, GetMips(rating), kMIPS);
|
||||
WCHAR s[64];
|
||||
NumberToDot3(GetMips(rating), s);
|
||||
MyStringCat(s, L" GIPS");
|
||||
MyStringCopy(NumberToDot3(GetMips(rating), s), L" GIPS");
|
||||
SetItemText(controlID, s);
|
||||
}
|
||||
|
||||
@@ -1391,7 +1386,7 @@ void CBenchmarkDialog::UpdateGui()
|
||||
}
|
||||
|
||||
|
||||
bool CBenchmarkDialog::OnCommand(int code, int itemID, LPARAM lParam)
|
||||
bool CBenchmarkDialog::OnCommand(unsigned code, unsigned itemID, LPARAM lParam)
|
||||
{
|
||||
if (code == CBN_SELCHANGE &&
|
||||
(itemID == IDC_BENCH_DICTIONARY ||
|
||||
@@ -1405,7 +1400,7 @@ bool CBenchmarkDialog::OnCommand(int code, int itemID, LPARAM lParam)
|
||||
}
|
||||
|
||||
|
||||
bool CBenchmarkDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
|
||||
bool CBenchmarkDialog::OnButtonClicked(unsigned buttonID, HWND buttonHWND)
|
||||
{
|
||||
switch (buttonID)
|
||||
{
|
||||
@@ -1425,14 +1420,14 @@ bool CBenchmarkDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
|
||||
|
||||
// ---------- Benchmark Thread ----------
|
||||
|
||||
struct CBenchCallback: public IBenchCallback
|
||||
struct CBenchCallback Z7_final: public IBenchCallback
|
||||
{
|
||||
UInt64 dictionarySize;
|
||||
CBenchProgressSync *Sync;
|
||||
CBenchmarkDialog *BenchmarkDialog;
|
||||
|
||||
HRESULT SetEncodeResult(const CBenchInfo &info, bool final);
|
||||
HRESULT SetDecodeResult(const CBenchInfo &info, bool final);
|
||||
HRESULT SetEncodeResult(const CBenchInfo &info, bool final) Z7_override;
|
||||
HRESULT SetDecodeResult(const CBenchInfo &info, bool final) Z7_override;
|
||||
};
|
||||
|
||||
HRESULT CBenchCallback::SetEncodeResult(const CBenchInfo &info, bool final)
|
||||
@@ -1494,14 +1489,14 @@ HRESULT CBenchCallback::SetDecodeResult(const CBenchInfo &info, bool final)
|
||||
}
|
||||
|
||||
|
||||
struct CBenchCallback2: public IBenchPrintCallback
|
||||
struct CBenchCallback2 Z7_final: public IBenchPrintCallback
|
||||
{
|
||||
CBenchProgressSync *Sync;
|
||||
bool TotalMode;
|
||||
|
||||
void Print(const char *s);
|
||||
void NewLine();
|
||||
HRESULT CheckBreak();
|
||||
void Print(const char *s) Z7_override;
|
||||
void NewLine() Z7_override;
|
||||
HRESULT CheckBreak() Z7_override;
|
||||
};
|
||||
|
||||
void CBenchCallback2::Print(const char *s)
|
||||
@@ -1528,12 +1523,12 @@ HRESULT CBenchCallback2::CheckBreak()
|
||||
|
||||
|
||||
|
||||
struct CFreqCallback: public IBenchFreqCallback
|
||||
struct CFreqCallback Z7_final: public IBenchFreqCallback
|
||||
{
|
||||
CBenchmarkDialog *BenchmarkDialog;
|
||||
|
||||
virtual HRESULT AddCpuFreq(unsigned numThreads, UInt64 freq, UInt64 usage);
|
||||
virtual HRESULT FreqsFinished(unsigned numThreads);
|
||||
virtual HRESULT AddCpuFreq(unsigned numThreads, UInt64 freq, UInt64 usage) Z7_override;
|
||||
virtual HRESULT FreqsFinished(unsigned numThreads) Z7_override;
|
||||
};
|
||||
|
||||
HRESULT CFreqCallback::AddCpuFreq(unsigned numThreads, UInt64 freq, UInt64 usage)
|
||||
@@ -1839,7 +1834,7 @@ HRESULT Benchmark(
|
||||
COneMethodInfo method;
|
||||
|
||||
UInt32 numCPUs = 1;
|
||||
#ifndef _7ZIP_ST
|
||||
#ifndef Z7_ST
|
||||
numCPUs = NSystem::GetNumberOfProcessors();
|
||||
#endif
|
||||
UInt32 numThreads = numCPUs;
|
||||
@@ -1860,8 +1855,8 @@ HRESULT Benchmark(
|
||||
ParseNumberString(prop.Value, propVariant);
|
||||
if (name.IsPrefixedBy(L"mt"))
|
||||
{
|
||||
#ifndef _7ZIP_ST
|
||||
RINOK(ParseMtProp(name.Ptr(2), propVariant, numCPUs, numThreads));
|
||||
#ifndef Z7_ST
|
||||
RINOK(ParseMtProp(name.Ptr(2), propVariant, numCPUs, numThreads))
|
||||
if (numThreads != numCPUs)
|
||||
bd.Sync.NumThreads = numThreads;
|
||||
#endif
|
||||
@@ -1893,14 +1888,14 @@ HRESULT Benchmark(
|
||||
if (method.Get_DicSize(dict))
|
||||
bd.Sync.DictSize = dict;
|
||||
}
|
||||
bd.Sync.Level = method.GetLevel();
|
||||
bd.Sync.Level = (int)method.GetLevel();
|
||||
|
||||
// Dummy(1000 * 1000 * 1);
|
||||
|
||||
{
|
||||
CThreadBenchmark &benchmarker = bd._threadBenchmark;
|
||||
#ifdef EXTERNAL_CODECS
|
||||
benchmarker.__externalCodecs = __externalCodecs;
|
||||
#ifdef Z7_EXTERNAL_CODECS
|
||||
benchmarker._externalCodecs = _externalCodecs;
|
||||
#endif
|
||||
benchmarker.BenchmarkDialog = &bd;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user