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 <string> |
| 9 |
8 #include "base/base_export.h" | 10 #include "base/base_export.h" |
9 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
10 #include "base/file_path.h" | 12 #include "base/file_path.h" |
11 #include "base/time.h" | 13 #include "base/time.h" |
12 | 14 #include "build/build_config.h" |
13 #include <string> | |
14 | |
15 class FilePath; | |
16 | 15 |
17 namespace base { | 16 namespace base { |
18 | 17 |
19 class BASE_EXPORT SysInfo { | 18 class BASE_EXPORT SysInfo { |
20 public: | 19 public: |
21 // Return the number of logical processors/cores on the current machine. | 20 // Return the number of logical processors/cores on the current machine. |
22 static int NumberOfProcessors(); | 21 static int NumberOfProcessors(); |
23 | 22 |
24 // Return the number of bytes of physical memory on the current machine. | 23 // Return the number of bytes of physical memory on the current machine. |
25 static int64 AmountOfPhysicalMemory(); | 24 static int64 AmountOfPhysicalMemory(); |
(...skipping 18 matching lines...) Expand all Loading... |
44 // corresponding unit test. | 43 // corresponding unit test. |
45 // DON'T USE THIS ON THE MAC OR WINDOWS to determine the current OS release | 44 // DON'T USE THIS ON THE MAC OR WINDOWS to determine the current OS release |
46 // for OS version-specific feature checks and workarounds. If you must use | 45 // for OS version-specific feature checks and workarounds. If you must use |
47 // an OS version check instead of a feature check, use the base::mac::IsOS* | 46 // an OS version check instead of a feature check, use the base::mac::IsOS* |
48 // family from base/mac/mac_util.h, or base::win::GetVersion from | 47 // family from base/mac/mac_util.h, or base::win::GetVersion from |
49 // base/win/windows_version.h. | 48 // base/win/windows_version.h. |
50 static void OperatingSystemVersionNumbers(int32* major_version, | 49 static void OperatingSystemVersionNumbers(int32* major_version, |
51 int32* minor_version, | 50 int32* minor_version, |
52 int32* bugfix_version); | 51 int32* bugfix_version); |
53 | 52 |
54 // Returns the CPU architecture of the system. Exact return value may differ | 53 // Returns the architecture of the running operating system. |
55 // across platforms. | 54 // Exact return value may differ across platforms. |
| 55 // e.g. a 32-bit x86 kernel on a 64-bit capable CPU will return "x86", |
| 56 // whereas a x86-64 kernel on the same CPU will return "x86_64" |
| 57 // TODO(thestig) Rename this to OperatingSystemArchitecture(). |
56 static std::string CPUArchitecture(); | 58 static std::string CPUArchitecture(); |
57 | 59 |
| 60 // Avoid using this. Use base/cpu.h to get information about the CPU instead. |
| 61 // http://crbug.com/148884 |
58 // Returns the CPU model name of the system. If it can not be figured out, | 62 // Returns the CPU model name of the system. If it can not be figured out, |
59 // an empty string is returned. | 63 // an empty string is returned. |
60 static std::string CPUModelName(); | 64 static std::string CPUModelName(); |
61 | 65 |
62 // Return the smallest amount of memory (in bytes) which the VM system will | 66 // Return the smallest amount of memory (in bytes) which the VM system will |
63 // allocate. | 67 // allocate. |
64 static size_t VMAllocationGranularity(); | 68 static size_t VMAllocationGranularity(); |
65 | 69 |
66 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 70 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
67 // Returns the maximum SysV shared memory segment size. | 71 // Returns the maximum SysV shared memory segment size. |
68 static size_t MaxSharedMemorySize(); | 72 static size_t MaxSharedMemorySize(); |
69 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) | 73 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) |
70 | 74 |
71 #if defined(OS_CHROMEOS) | 75 #if defined(OS_CHROMEOS) |
72 // Returns the name of the version entry we wish to look up in the | 76 // Returns the name of the version entry we wish to look up in the |
73 // Linux Standard Base release information file. | 77 // Linux Standard Base release information file. |
74 static std::string GetLinuxStandardBaseVersionKey(); | 78 static std::string GetLinuxStandardBaseVersionKey(); |
75 | 79 |
76 // Parses /etc/lsb-release to get version information for Google Chrome OS. | 80 // Parses /etc/lsb-release to get version information for Google Chrome OS. |
77 // Declared here so it can be exposed for unit testing. | 81 // Declared here so it can be exposed for unit testing. |
78 static void ParseLsbRelease(const std::string& lsb_release, | 82 static void ParseLsbRelease(const std::string& lsb_release, |
79 int32* major_version, | 83 int32* major_version, |
80 int32* minor_version, | 84 int32* minor_version, |
81 int32* bugfix_version); | 85 int32* bugfix_version); |
82 | 86 |
83 // Returns the path to the lsb-release file. | 87 // Returns the path to the lsb-release file. |
84 static FilePath GetLsbReleaseFilePath(); | 88 static FilePath GetLsbReleaseFilePath(); |
85 #endif // defined(OS_CHROMEOS) | 89 #endif // defined(OS_CHROMEOS) |
86 | 90 |
87 #if defined(OS_ANDROID) | 91 #if defined(OS_ANDROID) |
88 // Returns the Android build's codename. | 92 // Returns the Android build's codename. |
89 static std::string GetAndroidBuildCodename(); | 93 static std::string GetAndroidBuildCodename(); |
90 | 94 |
91 // Returns the Android build ID. | 95 // Returns the Android build ID. |
92 static std::string GetAndroidBuildID(); | 96 static std::string GetAndroidBuildID(); |
93 | 97 |
94 // Returns the device's name. | 98 // Returns the device's name. |
95 static std::string GetDeviceName(); | 99 static std::string GetDeviceName(); |
96 | 100 |
97 static int DalvikHeapSizeMB(); | 101 static int DalvikHeapSizeMB(); |
98 #endif // defined(OS_ANDROID) | 102 #endif // defined(OS_ANDROID) |
99 }; | 103 }; |
100 | 104 |
101 } // namespace base | 105 } // namespace base |
102 | 106 |
103 #endif // BASE_SYS_INFO_H_ | 107 #endif // BASE_SYS_INFO_H_ |
OLD | NEW |