diff options
author | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-17 13:10:45 +0000 |
---|---|---|
committer | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-17 13:10:45 +0000 |
commit | d632798e22600557d9bb2c84450dd110cb9d6230 (patch) | |
tree | 14a3498d0262e8e87a684c0e97d4d62db3a90491 /base/sys_info_win.cc | |
parent | 2a758d61d9ee5c8ae43bf5a6d974d27cc6779ef2 (diff) | |
download | chromium_src-d632798e22600557d9bb2c84450dd110cb9d6230.zip chromium_src-d632798e22600557d9bb2c84450dd110cb9d6230.tar.gz chromium_src-d632798e22600557d9bb2c84450dd110cb9d6230.tar.bz2 |
Add support for querying the amount of memory on a system to sys_info.
Review URL: http://codereview.chromium.org/2927
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2303 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/sys_info_win.cc')
-rw-r--r-- | base/sys_info_win.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/base/sys_info_win.cc b/base/sys_info_win.cc index 4d32489..8b6dfea 100644 --- a/base/sys_info_win.cc +++ b/base/sys_info_win.cc @@ -6,6 +6,8 @@ #include <windows.h> +#include "base/logging.h" + namespace base { // static @@ -15,4 +17,16 @@ int SysInfo::NumberOfProcessors() { return static_cast<int>(info.dwNumberOfProcessors); } +// static +int64 SysInfo::AmountOfPhysicalMemory() { + MEMORYSTATUSEX memory_info; + memory_info.dwLength = sizeof(memory_info); + if (!GlobalMemoryStatusEx(&memory_info)) { + NOTREACHED(); + return 0; + } + + return static_cast<int64>(memory_info.ullTotalPhys); +} + } // namespace base |