Fix DetectNumberOfCores for 32-bit processes
GetSystemInfo will not return more than 32 for dwNumberOfProcessors when called from a 32-bit process. This means that Chrome lies to me whenever I enable logging. Calling GetNativeSystemInfo allows Chrome to return up to 64 as the processor count. GetNativeSystemInfo even runs on WindowsXP if that matters. With the fix applied in a Chromium repo the logging at startup now says: [320:196:712/335.515:INFO:cpu_info.cc(50)] Available number of cores: 48 BUG=webrtc:7981 Review-Url: https://codereview.webrtc.org/2978863002 Cr-Commit-Position: refs/heads/master@{#19008}
This commit is contained in:
@ -32,7 +32,7 @@ static int DetectNumberOfCores() {
|
||||
|
||||
#if defined(WEBRTC_WIN)
|
||||
SYSTEM_INFO si;
|
||||
GetSystemInfo(&si);
|
||||
GetNativeSystemInfo(&si);
|
||||
number_of_cores = static_cast<int>(si.dwNumberOfProcessors);
|
||||
#elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID)
|
||||
number_of_cores = static_cast<int>(sysconf(_SC_NPROCESSORS_ONLN));
|
||||
|
||||
Reference in New Issue
Block a user