From 2178f700f6a375c67f4246e3492b09e34c551711 Mon Sep 17 00:00:00 2001 From: brucedawson Date: Thu, 13 Jul 2017 10:06:12 -0700 Subject: [PATCH] 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} --- webrtc/system_wrappers/source/cpu_info.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webrtc/system_wrappers/source/cpu_info.cc b/webrtc/system_wrappers/source/cpu_info.cc index f151ceaae7..590d2d975c 100644 --- a/webrtc/system_wrappers/source/cpu_info.cc +++ b/webrtc/system_wrappers/source/cpu_info.cc @@ -32,7 +32,7 @@ static int DetectNumberOfCores() { #if defined(WEBRTC_WIN) SYSTEM_INFO si; - GetSystemInfo(&si); + GetNativeSystemInfo(&si); number_of_cores = static_cast(si.dwNumberOfProcessors); #elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID) number_of_cores = static_cast(sysconf(_SC_NPROCESSORS_ONLN));