Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(484)

Side by Side Diff: base/sys_info.h

Issue 1498003003: Remove kint64max. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: INT64_MAX Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/basictypes.h ('k') | base/sys_info.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stdint.h>
9
8 #include <map> 10 #include <map>
9 #include <string> 11 #include <string>
10 12
11 #include "base/base_export.h" 13 #include "base/base_export.h"
12 #include "base/basictypes.h"
13 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
14 #include "base/time/time.h" 15 #include "base/time/time.h"
15 #include "build/build_config.h" 16 #include "build/build_config.h"
16 17
17 namespace base { 18 namespace base {
18 19
19 class BASE_EXPORT SysInfo { 20 class BASE_EXPORT SysInfo {
20 public: 21 public:
21 // Return the number of logical processors/cores on the current machine. 22 // Return the number of logical processors/cores on the current machine.
22 static int NumberOfProcessors(); 23 static int NumberOfProcessors();
23 24
24 // Return the number of bytes of physical memory on the current machine. 25 // Return the number of bytes of physical memory on the current machine.
25 static int64 AmountOfPhysicalMemory(); 26 static int64_t AmountOfPhysicalMemory();
26 27
27 // Return the number of bytes of current available physical memory on the 28 // Return the number of bytes of current available physical memory on the
28 // machine. 29 // machine.
29 static int64 AmountOfAvailablePhysicalMemory(); 30 static int64_t AmountOfAvailablePhysicalMemory();
30 31
31 // Return the number of bytes of virtual memory of this process. A return 32 // Return the number of bytes of virtual memory of this process. A return
32 // value of zero means that there is no limit on the available virtual 33 // value of zero means that there is no limit on the available virtual
33 // memory. 34 // memory.
34 static int64 AmountOfVirtualMemory(); 35 static int64_t AmountOfVirtualMemory();
35 36
36 // Return the number of megabytes of physical memory on the current machine. 37 // Return the number of megabytes of physical memory on the current machine.
37 static int AmountOfPhysicalMemoryMB() { 38 static int AmountOfPhysicalMemoryMB() {
38 return static_cast<int>(AmountOfPhysicalMemory() / 1024 / 1024); 39 return static_cast<int>(AmountOfPhysicalMemory() / 1024 / 1024);
39 } 40 }
40 41
41 // Return the number of megabytes of available virtual memory, or zero if it 42 // Return the number of megabytes of available virtual memory, or zero if it
42 // is unlimited. 43 // is unlimited.
43 static int AmountOfVirtualMemoryMB() { 44 static int AmountOfVirtualMemoryMB() {
44 return static_cast<int>(AmountOfVirtualMemory() / 1024 / 1024); 45 return static_cast<int>(AmountOfVirtualMemory() / 1024 / 1024);
45 } 46 }
46 47
47 // Return the available disk space in bytes on the volume containing |path|, 48 // Return the available disk space in bytes on the volume containing |path|,
48 // or -1 on failure. 49 // or -1 on failure.
49 static int64 AmountOfFreeDiskSpace(const FilePath& path); 50 static int64_t AmountOfFreeDiskSpace(const FilePath& path);
50 51
51 // Returns system uptime. 52 // Returns system uptime.
52 static TimeDelta Uptime(); 53 static TimeDelta Uptime();
53 54
54 // Returns a descriptive string for the current machine model or an empty 55 // Returns a descriptive string for the current machine model or an empty
55 // string if the machine model is unknown or an error occured. 56 // string if the machine model is unknown or an error occured.
56 // e.g. "MacPro1,1" on Mac, or "Nexus 5" on Android. Only implemented on OS X, 57 // e.g. "MacPro1,1" on Mac, or "Nexus 5" on Android. Only implemented on OS X,
57 // Android, and Chrome OS. This returns an empty string on other platforms. 58 // Android, and Chrome OS. This returns an empty string on other platforms.
58 static std::string HardwareModelName(); 59 static std::string HardwareModelName();
59 60
60 // Returns the name of the host operating system. 61 // Returns the name of the host operating system.
61 static std::string OperatingSystemName(); 62 static std::string OperatingSystemName();
62 63
63 // Returns the version of the host operating system. 64 // Returns the version of the host operating system.
64 static std::string OperatingSystemVersion(); 65 static std::string OperatingSystemVersion();
65 66
66 // Retrieves detailed numeric values for the OS version. 67 // Retrieves detailed numeric values for the OS version.
67 // TODO(port): Implement a Linux version of this method and enable the 68 // TODO(port): Implement a Linux version of this method and enable the
68 // corresponding unit test. 69 // corresponding unit test.
69 // DON'T USE THIS ON THE MAC OR WINDOWS to determine the current OS release 70 // DON'T USE THIS ON THE MAC OR WINDOWS to determine the current OS release
70 // for OS version-specific feature checks and workarounds. If you must use 71 // for OS version-specific feature checks and workarounds. If you must use
71 // an OS version check instead of a feature check, use the base::mac::IsOS* 72 // an OS version check instead of a feature check, use the base::mac::IsOS*
72 // family from base/mac/mac_util.h, or base::win::GetVersion from 73 // family from base/mac/mac_util.h, or base::win::GetVersion from
73 // base/win/windows_version.h. 74 // base/win/windows_version.h.
74 static void OperatingSystemVersionNumbers(int32* major_version, 75 static void OperatingSystemVersionNumbers(int32_t* major_version,
75 int32* minor_version, 76 int32_t* minor_version,
76 int32* bugfix_version); 77 int32_t* bugfix_version);
77 78
78 // Returns the architecture of the running operating system. 79 // Returns the architecture of the running operating system.
79 // Exact return value may differ across platforms. 80 // Exact return value may differ across platforms.
80 // e.g. a 32-bit x86 kernel on a 64-bit capable CPU will return "x86", 81 // e.g. a 32-bit x86 kernel on a 64-bit capable CPU will return "x86",
81 // whereas a x86-64 kernel on the same CPU will return "x86_64" 82 // whereas a x86-64 kernel on the same CPU will return "x86_64"
82 static std::string OperatingSystemArchitecture(); 83 static std::string OperatingSystemArchitecture();
83 84
84 // Avoid using this. Use base/cpu.h to get information about the CPU instead. 85 // Avoid using this. Use base/cpu.h to get information about the CPU instead.
85 // http://crbug.com/148884 86 // http://crbug.com/148884
86 // Returns the CPU model name of the system. If it can not be figured out, 87 // Returns the CPU model name of the system. If it can not be figured out,
87 // an empty string is returned. 88 // an empty string is returned.
88 static std::string CPUModelName(); 89 static std::string CPUModelName();
89 90
90 // Return the smallest amount of memory (in bytes) which the VM system will 91 // Return the smallest amount of memory (in bytes) which the VM system will
91 // allocate. 92 // allocate.
92 static size_t VMAllocationGranularity(); 93 static size_t VMAllocationGranularity();
93 94
94 #if defined(OS_POSIX) && !defined(OS_MACOSX) 95 #if defined(OS_POSIX) && !defined(OS_MACOSX)
95 // Returns the maximum SysV shared memory segment size, or zero if there is no 96 // Returns the maximum SysV shared memory segment size, or zero if there is no
96 // limit. 97 // limit.
97 static uint64 MaxSharedMemorySize(); 98 static uint64_t MaxSharedMemorySize();
98 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) 99 #endif // defined(OS_POSIX) && !defined(OS_MACOSX)
99 100
100 #if defined(OS_CHROMEOS) 101 #if defined(OS_CHROMEOS)
101 typedef std::map<std::string, std::string> LsbReleaseMap; 102 typedef std::map<std::string, std::string> LsbReleaseMap;
102 103
103 // Returns the contents of /etc/lsb-release as a map. 104 // Returns the contents of /etc/lsb-release as a map.
104 static const LsbReleaseMap& GetLsbReleaseMap(); 105 static const LsbReleaseMap& GetLsbReleaseMap();
105 106
106 // If |key| is present in the LsbReleaseMap, sets |value| and returns true. 107 // If |key| is present in the LsbReleaseMap, sets |value| and returns true.
107 static bool GetLsbReleaseValue(const std::string& key, std::string* value); 108 static bool GetLsbReleaseValue(const std::string& key, std::string* value);
(...skipping 27 matching lines...) Expand all
135 136
136 // Returns true if this is a low-end device. 137 // Returns true if this is a low-end device.
137 // Low-end device refers to devices having less than 512M memory in the 138 // Low-end device refers to devices having less than 512M memory in the
138 // current implementation. 139 // current implementation.
139 static bool IsLowEndDevice(); 140 static bool IsLowEndDevice();
140 }; 141 };
141 142
142 } // namespace base 143 } // namespace base
143 144
144 #endif // BASE_SYS_INFO_H_ 145 #endif // BASE_SYS_INFO_H_
OLDNEW
« no previous file with comments | « base/basictypes.h ('k') | base/sys_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698