diff options
author | sgk@chromium.org <sgk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-09 06:57:28 +0000 |
---|---|---|
committer | sgk@chromium.org <sgk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-09 06:57:28 +0000 |
commit | ed26d948be84443236a8a165ac2a3ccf63c2e02a (patch) | |
tree | a41de5ad3954557cbf9a7b0e1bc61c923fc05269 /base/process_util_mac.mm | |
parent | ad33fd4bdd8b7117e2644b34f553a2f14faea653 (diff) | |
download | chromium_src-ed26d948be84443236a8a165ac2a3ccf63c2e02a.zip chromium_src-ed26d948be84443236a8a165ac2a3ccf63c2e02a.tar.gz chromium_src-ed26d948be84443236a8a165ac2a3ccf63c2e02a.tar.bz2 |
More memory stats code cleanup:
Move GetSystemCommitCharge() into bsae\process_util*.
Kill PrintChromeMemoryUsageInfo(), which was only used by
reliability_tests.exe on Windows and whose stats are obsolete.
Delete the now-unnecessary chrome\test\perf\mem_usage* files.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/371025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31423 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/process_util_mac.mm')
-rw-r--r-- | base/process_util_mac.mm | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/base/process_util_mac.mm b/base/process_util_mac.mm index 61029c0..e1574e5 100644 --- a/base/process_util_mac.mm +++ b/base/process_util_mac.mm @@ -7,6 +7,7 @@ #import <Cocoa/Cocoa.h> #include <crt_externs.h> +#include <mach/mach.h> #include <mach/mach_init.h> #include <mach/task.h> #include <spawn.h> @@ -213,4 +214,25 @@ bool ProcessMetrics::GetWorkingSetKBytes(WorkingSetKBytes* ws_usage) const { // ------------------------------------------------------------------------ +// Bytes committed by the system. +size_t GetSystemCommitCharge() { + host_name_port_t host = mach_host_self(); + mach_msg_type_number_t count = HOST_VM_INFO_COUNT; + vm_statistics_data_t data; + kern_return_t kr = host_statistics(host, HOST_VM_INFO, + reinterpret_cast<host_info_t>(&data), + &count); + if (kr) + LOG(ERROR) << "Failed to fetch host statistics."; + return 0; + + vm_size_t page_size; + kr = host_page_size(host, &page_size); + if (kr) + LOG(ERROR) << "Failed to fetch host page size."; + return 0; + + return (data.active_count * page_size) / 1024; +} + } // namespace base |