Refine systemInfo.cpu API and provide systemInfo.cpu.get impl for Windows and Linux.
BUG=136519
TEST=browser_test --gtest_filter=SystemInfoCpuApiTest.*
Review URL: https://chromiumcodereview.appspot.com/10914060
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155575 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/base/sys_info_mac.cc b/base/sys_info_mac.cc
index 1a1d23c..3a93689 100644
--- a/base/sys_info_mac.cc
+++ b/base/sys_info_mac.cc
@@ -8,6 +8,8 @@
#include <CoreServices/CoreServices.h>
#include <mach/mach_host.h>
#include <mach/mach_init.h>
+#include <sys/sysctl.h>
+#include <sys/types.h>
#include "base/logging.h"
#include "base/stringprintf.h"
@@ -54,4 +56,13 @@
return static_cast<int64>(hostinfo.max_mem);
}
+// static
+std::string SysInfo::CPUModelName() {
+ char name[256];
+ size_t len = arraysize(name);
+ if (sysctlbyname("machdep.cpu.brand_string", &name, &len, NULL, 0) == 0)
+ return name;
+ return std::string();
+}
+
} // namespace base