| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/base_export.h" | 14 #include "base/base_export.h" |
| 15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 | 18 |
| 19 namespace base { | 19 namespace base { |
| 20 | 20 |
| 21 struct SystemMemoryInfoKB; |
| 22 |
| 21 class BASE_EXPORT SysInfo { | 23 class BASE_EXPORT SysInfo { |
| 22 public: | 24 public: |
| 23 // Return the number of logical processors/cores on the current machine. | 25 // Return the number of logical processors/cores on the current machine. |
| 24 static int NumberOfProcessors(); | 26 static int NumberOfProcessors(); |
| 25 | 27 |
| 26 // Return the number of bytes of physical memory on the current machine. | 28 // Return the number of bytes of physical memory on the current machine. |
| 27 static int64_t AmountOfPhysicalMemory(); | 29 static int64_t AmountOfPhysicalMemory(); |
| 28 | 30 |
| 29 // Return the number of bytes of current available physical memory on the | 31 // Return the number of bytes of current available physical memory on the |
| 30 // machine. | 32 // machine. |
| 33 // (The amount of memory that can be allocated without any significant |
| 34 // impact on the system. It can lead to freeing inactive file-backed |
| 35 // and/or speculative file-backed memory). |
| 31 static int64_t AmountOfAvailablePhysicalMemory(); | 36 static int64_t AmountOfAvailablePhysicalMemory(); |
| 37 #if defined(OS_LINUX) || defined(OS_ANDROID) |
| 38 static int64_t AmountOfAvailablePhysicalMemory( |
| 39 const SystemMemoryInfoKB& meminfo); |
| 40 #endif |
| 32 | 41 |
| 33 // Return the number of bytes of virtual memory of this process. A return | 42 // Return the number of bytes of virtual memory of this process. A return |
| 34 // value of zero means that there is no limit on the available virtual | 43 // value of zero means that there is no limit on the available virtual |
| 35 // memory. | 44 // memory. |
| 36 static int64_t AmountOfVirtualMemory(); | 45 static int64_t AmountOfVirtualMemory(); |
| 37 | 46 |
| 38 // Return the number of megabytes of physical memory on the current machine. | 47 // Return the number of megabytes of physical memory on the current machine. |
| 39 static int AmountOfPhysicalMemoryMB() { | 48 static int AmountOfPhysicalMemoryMB() { |
| 40 return static_cast<int>(AmountOfPhysicalMemory() / 1024 / 1024); | 49 return static_cast<int>(AmountOfPhysicalMemory() / 1024 / 1024); |
| 41 } | 50 } |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 154 |
| 146 // Returns true if this is a low-end device. | 155 // Returns true if this is a low-end device. |
| 147 // Low-end device refers to devices having less than 512M memory in the | 156 // Low-end device refers to devices having less than 512M memory in the |
| 148 // current implementation. | 157 // current implementation. |
| 149 static bool IsLowEndDevice(); | 158 static bool IsLowEndDevice(); |
| 150 }; | 159 }; |
| 151 | 160 |
| 152 } // namespace base | 161 } // namespace base |
| 153 | 162 |
| 154 #endif // BASE_SYS_INFO_H_ | 163 #endif // BASE_SYS_INFO_H_ |
| OLD | NEW |