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 #ifndef BASE_SYS_INFO_H_ | 5 #ifndef BASE_SYS_INFO_H_ |
6 #define BASE_SYS_INFO_H_ | 6 #define BASE_SYS_INFO_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 // Return the number of megabytes of available virtual memory, or zero if it | 41 // Return the number of megabytes of available virtual memory, or zero if it |
42 // is unlimited. | 42 // is unlimited. |
43 static int AmountOfVirtualMemoryMB() { | 43 static int AmountOfVirtualMemoryMB() { |
44 return static_cast<int>(AmountOfVirtualMemory() / 1024 / 1024); | 44 return static_cast<int>(AmountOfVirtualMemory() / 1024 / 1024); |
45 } | 45 } |
46 | 46 |
47 // Return the available disk space in bytes on the volume containing |path|, | 47 // Return the available disk space in bytes on the volume containing |path|, |
48 // or -1 on failure. | 48 // or -1 on failure. |
49 static int64 AmountOfFreeDiskSpace(const FilePath& path); | 49 static int64 AmountOfFreeDiskSpace(const FilePath& path); |
50 | 50 |
51 // Determine whether the device that services |path| has a seek penalty. | |
52 // Returns false if it couldn't be determined (e.g., |path| doesn't exist). | |
53 static bool HasSeekPenalty(const FilePath& path, bool* has_seek_penalty); | |
54 | |
55 // Returns system uptime in milliseconds. | 51 // Returns system uptime in milliseconds. |
56 static int64 Uptime(); | 52 static int64 Uptime(); |
57 | 53 |
58 // Returns a descriptive string for the current machine model or an empty | 54 // Returns a descriptive string for the current machine model or an empty |
59 // string if machime model is unknown or an error occured. | 55 // string if machime model is unknown or an error occured. |
60 // e.g. MacPro1,1 on Mac. | 56 // e.g. MacPro1,1 on Mac. |
61 // Only implemented on OS X, will return an empty string on other platforms. | 57 // Only implemented on OS X, will return an empty string on other platforms. |
62 static std::string HardwareModelName(); | 58 static std::string HardwareModelName(); |
63 | 59 |
64 // Returns the name of the host operating system. | 60 // Returns the name of the host operating system. |
(...skipping 26 matching lines...) Expand all Loading... |
91 // an empty string is returned. | 87 // an empty string is returned. |
92 static std::string CPUModelName(); | 88 static std::string CPUModelName(); |
93 | 89 |
94 // Return the smallest amount of memory (in bytes) which the VM system will | 90 // Return the smallest amount of memory (in bytes) which the VM system will |
95 // allocate. | 91 // allocate. |
96 static size_t VMAllocationGranularity(); | 92 static size_t VMAllocationGranularity(); |
97 | 93 |
98 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 94 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
99 // Returns the maximum SysV shared memory segment size, or zero if there is no | 95 // Returns the maximum SysV shared memory segment size, or zero if there is no |
100 // limit. | 96 // limit. |
101 static size_t MaxSharedMemorySize(); | 97 static uint64 MaxSharedMemorySize(); |
102 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) | 98 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) |
103 | 99 |
104 #if defined(OS_CHROMEOS) | 100 #if defined(OS_CHROMEOS) |
105 typedef std::map<std::string, std::string> LsbReleaseMap; | 101 typedef std::map<std::string, std::string> LsbReleaseMap; |
106 | 102 |
107 // Returns the contents of /etc/lsb-release as a map. | 103 // Returns the contents of /etc/lsb-release as a map. |
108 static const LsbReleaseMap& GetLsbReleaseMap(); | 104 static const LsbReleaseMap& GetLsbReleaseMap(); |
109 | 105 |
110 // If |key| is present in the LsbReleaseMap, sets |value| and returns true. | 106 // If |key| is present in the LsbReleaseMap, sets |value| and returns true. |
111 static bool GetLsbReleaseValue(const std::string& key, std::string* value); | 107 static bool GetLsbReleaseValue(const std::string& key, std::string* value); |
(...skipping 30 matching lines...) Expand all Loading... |
142 | 138 |
143 // Returns true if this is a low-end device. | 139 // Returns true if this is a low-end device. |
144 // Low-end device refers to devices having less than 512M memory in the | 140 // Low-end device refers to devices having less than 512M memory in the |
145 // current implementation. | 141 // current implementation. |
146 static bool IsLowEndDevice(); | 142 static bool IsLowEndDevice(); |
147 }; | 143 }; |
148 | 144 |
149 } // namespace base | 145 } // namespace base |
150 | 146 |
151 #endif // BASE_SYS_INFO_H_ | 147 #endif // BASE_SYS_INFO_H_ |
OLD | NEW |