| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/sys_info.h" | 5 #include "base/sys_info.h" |
| 6 | 6 |
| 7 #import <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
| 8 #include <mach/mach.h> | 8 #include <mach/mach.h> |
| 9 #include <sys/sysctl.h> |
| 10 #include <sys/types.h> |
| 9 | 11 |
| 10 #include "base/logging.h" | 12 #include "base/logging.h" |
| 11 #include "base/mac/scoped_nsautorelease_pool.h" | 13 #include "base/mac/scoped_nsautorelease_pool.h" |
| 12 #include "base/sys_string_conversions.h" | 14 #include "base/sys_string_conversions.h" |
| 13 | 15 |
| 14 namespace base { | 16 namespace base { |
| 15 | 17 |
| 16 // static | 18 // static |
| 17 std::string SysInfo::OperatingSystemName() { | 19 std::string SysInfo::OperatingSystemName() { |
| 18 base::mac::ScopedNSAutoreleasePool pool; | 20 base::mac::ScopedNSAutoreleasePool pool; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 reinterpret_cast<host_info_t>(&hostinfo), | 60 reinterpret_cast<host_info_t>(&hostinfo), |
| 59 &count); | 61 &count); |
| 60 if (result != KERN_SUCCESS) { | 62 if (result != KERN_SUCCESS) { |
| 61 NOTREACHED(); | 63 NOTREACHED(); |
| 62 return 0; | 64 return 0; |
| 63 } | 65 } |
| 64 DCHECK_EQ(HOST_BASIC_INFO_COUNT, count); | 66 DCHECK_EQ(HOST_BASIC_INFO_COUNT, count); |
| 65 return static_cast<int64>(hostinfo.max_mem); | 67 return static_cast<int64>(hostinfo.max_mem); |
| 66 } | 68 } |
| 67 | 69 |
| 70 // static |
| 71 std::string SysInfo::CPUModelName() { |
| 72 char name[256]; |
| 73 size_t len = arraysize(name); |
| 74 if (sysctlbyname("machdep.cpu.brand_string", &name, &len, NULL, 0) == 0) |
| 75 return name; |
| 76 return std::string(); |
| 77 } |
| 78 |
| 68 } // namespace base | 79 } // namespace base |
| OLD | NEW |