Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1294)

Unified Diff: webrtc/system_wrappers/source/cpu_info.cc

Issue 1286163003: Move SystemInfo to rtc_base_approved and delete unused code. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Address comments Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/system_wrappers/interface/cpu_info.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/system_wrappers/source/cpu_info.cc
diff --git a/webrtc/system_wrappers/source/cpu_info.cc b/webrtc/system_wrappers/source/cpu_info.cc
index c482d879cfbb7052847ec82d2fcfd3be17df3e44..ebbb08a95cca349f9f027e12622dc3fe5bd319ea 100644
--- a/webrtc/system_wrappers/source/cpu_info.cc
+++ b/webrtc/system_wrappers/source/cpu_info.cc
@@ -10,55 +10,12 @@
#include "webrtc/system_wrappers/interface/cpu_info.h"
-#if defined(_WIN32)
-#include <Windows.h>
-#elif defined(WEBRTC_MAC)
-#include <sys/sysctl.h>
-#include <sys/types.h>
-#else // defined(WEBRTC_LINUX) or defined(WEBRTC_ANDROID)
-#include <unistd.h>
-#endif
-
-#include "webrtc/system_wrappers/interface/trace.h"
+#include "webrtc/base/systeminfo.h"
namespace webrtc {
-uint32_t CpuInfo::number_of_cores_ = 0;
-
uint32_t CpuInfo::DetectNumberOfCores() {
- if (!number_of_cores_) {
-#if defined(_WIN32)
- SYSTEM_INFO si;
- GetSystemInfo(&si);
- number_of_cores_ = static_cast<uint32_t>(si.dwNumberOfProcessors);
- WEBRTC_TRACE(kTraceStateInfo, kTraceUtility, -1,
- "Available number of cores:%d", number_of_cores_);
-
-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID)
- number_of_cores_ = static_cast<uint32_t>(sysconf(_SC_NPROCESSORS_ONLN));
- WEBRTC_TRACE(kTraceStateInfo, kTraceUtility, -1,
- "Available number of cores:%d", number_of_cores_);
-
-#elif defined(WEBRTC_MAC)
- int name[] = {CTL_HW, HW_AVAILCPU};
- int ncpu;
- size_t size = sizeof(ncpu);
- if (0 == sysctl(name, 2, &ncpu, &size, NULL, 0)) {
- number_of_cores_ = static_cast<uint32_t>(ncpu);
- WEBRTC_TRACE(kTraceStateInfo, kTraceUtility, -1,
- "Available number of cores:%d", number_of_cores_);
- } else {
- WEBRTC_TRACE(kTraceError, kTraceUtility, -1,
- "Failed to get number of cores");
- number_of_cores_ = 1;
- }
-#else
- WEBRTC_TRACE(kTraceWarning, kTraceUtility, -1,
- "No function to get number of cores");
- number_of_cores_ = 1;
-#endif
- }
- return number_of_cores_;
+ return static_cast<uint32_t>(rtc::SystemInfo::GetMaxCpus());
}
} // namespace webrtc
« no previous file with comments | « webrtc/system_wrappers/interface/cpu_info.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698