diff options
| author | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2026-02-12 00:00:00 +0000 |
|---|---|---|
| committer | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2026-02-12 17:38:49 +0500 |
| commit | 839151eaaad24771892afaae6bac690e31e58384 (patch) | |
| tree | e292449d621f7a1d503b975984a2aca240dd2d8f /CPP/Windows/System.h | |
| parent | 5e96a8279489832924056b1fa82f29d5837c9469 (diff) | |
| download | 7zip-839151eaaad24771892afaae6bac690e31e58384.tar.gz 7zip-839151eaaad24771892afaae6bac690e31e58384.tar.bz2 7zip-839151eaaad24771892afaae6bac690e31e58384.zip | |
Diffstat (limited to 'CPP/Windows/System.h')
| -rw-r--r-- | CPP/Windows/System.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/CPP/Windows/System.h b/CPP/Windows/System.h index 0c80373..041a44d 100644 --- a/CPP/Windows/System.h +++ b/CPP/Windows/System.h | |||
| @@ -15,6 +15,8 @@ | |||
| 15 | namespace NWindows { | 15 | namespace NWindows { |
| 16 | namespace NSystem { | 16 | namespace NSystem { |
| 17 | 17 | ||
| 18 | UInt32 GetNumberOfProcessors(); | ||
| 19 | |||
| 18 | #ifdef _WIN32 | 20 | #ifdef _WIN32 |
| 19 | 21 | ||
| 20 | struct CCpuGroups | 22 | struct CCpuGroups |
| @@ -103,6 +105,25 @@ struct CProcessAffinity | |||
| 103 | return CountAffinity(systemAffinityMask); | 105 | return CountAffinity(systemAffinityMask); |
| 104 | } | 106 | } |
| 105 | 107 | ||
| 108 | // it returns normilized number of threads | ||
| 109 | void Get_and_return_NumProcessThreads_and_SysThreads(UInt32 &numProcessThreads, UInt32 &numSysThreads) | ||
| 110 | { | ||
| 111 | UInt32 num1 = 0, num2 = 0; | ||
| 112 | if (Get()) | ||
| 113 | { | ||
| 114 | num1 = GetNumProcessThreads(); | ||
| 115 | num2 = GetNumSystemThreads(); | ||
| 116 | } | ||
| 117 | if (num1 == 0) | ||
| 118 | num1 = NSystem::GetNumberOfProcessors(); | ||
| 119 | if (num1 == 0) | ||
| 120 | num1 = 1; | ||
| 121 | if (num2 < num1) | ||
| 122 | num2 = num1; | ||
| 123 | numProcessThreads = num1; | ||
| 124 | numSysThreads = num2; | ||
| 125 | } | ||
| 126 | |||
| 106 | BOOL Get(); | 127 | BOOL Get(); |
| 107 | 128 | ||
| 108 | BOOL SetProcAffinity() const | 129 | BOOL SetProcAffinity() const |
| @@ -177,8 +198,6 @@ struct CProcessAffinity | |||
| 177 | #endif // _WIN32 | 198 | #endif // _WIN32 |
| 178 | 199 | ||
| 179 | 200 | ||
| 180 | UInt32 GetNumberOfProcessors(); | ||
| 181 | |||
| 182 | bool GetRamSize(size_t &size); // returns false, if unknown ram size | 201 | bool GetRamSize(size_t &size); // returns false, if unknown ram size |
| 183 | 202 | ||
| 184 | unsigned long Get_File_OPEN_MAX(); | 203 | unsigned long Get_File_OPEN_MAX(); |
