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 #include <ApplicationServices/ApplicationServices.h> | 7 #include <ApplicationServices/ApplicationServices.h> |
8 #include <CoreServices/CoreServices.h> | 8 #include <CoreServices/CoreServices.h> |
9 #include <mach/mach_host.h> | 9 #include <mach/mach_host.h> |
10 #include <mach/mach_init.h> | 10 #include <mach/mach_init.h> |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 reinterpret_cast<host_info_t>(&vm_info), | 69 reinterpret_cast<host_info_t>(&vm_info), |
70 &count) != KERN_SUCCESS) { | 70 &count) != KERN_SUCCESS) { |
71 NOTREACHED(); | 71 NOTREACHED(); |
72 return 0; | 72 return 0; |
73 } | 73 } |
74 | 74 |
75 return static_cast<int64>( | 75 return static_cast<int64>( |
76 vm_info.free_count - vm_info.speculative_count) * PAGE_SIZE; | 76 vm_info.free_count - vm_info.speculative_count) * PAGE_SIZE; |
77 } | 77 } |
78 | 78 |
79 bool SysInfo::HasSeekPenalty(const FilePath& path, bool* has_seek_penalty) { | |
80 // TODO(dbeam): implement. | |
81 return false; | |
82 } | |
83 | |
84 // static | 79 // static |
85 std::string SysInfo::CPUModelName() { | 80 std::string SysInfo::CPUModelName() { |
86 char name[256]; | 81 char name[256]; |
87 size_t len = arraysize(name); | 82 size_t len = arraysize(name); |
88 if (sysctlbyname("machdep.cpu.brand_string", &name, &len, NULL, 0) == 0) | 83 if (sysctlbyname("machdep.cpu.brand_string", &name, &len, NULL, 0) == 0) |
89 return name; | 84 return name; |
90 return std::string(); | 85 return std::string(); |
91 } | 86 } |
92 | 87 |
93 std::string SysInfo::HardwareModelName() { | 88 std::string SysInfo::HardwareModelName() { |
94 char model[256]; | 89 char model[256]; |
95 size_t len = sizeof(model); | 90 size_t len = sizeof(model); |
96 if (sysctlbyname("hw.model", model, &len, NULL, 0) == 0) | 91 if (sysctlbyname("hw.model", model, &len, NULL, 0) == 0) |
97 return std::string(model, 0, len); | 92 return std::string(model, 0, len); |
98 return std::string(); | 93 return std::string(); |
99 } | 94 } |
100 | 95 |
101 } // namespace base | 96 } // namespace base |
OLD | NEW |