summaryrefslogtreecommitdiffstats
path: root/chrome/browser/memory_details.cc
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-05 23:37:40 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-05 23:37:40 +0000
commitf164cea41472f9e9ec21579233e2c42a7b9d5184 (patch)
tree523c6aa180be86ace3ac7797e4c9c75c369dff57 /chrome/browser/memory_details.cc
parent422c0f17466cddf30fd6815f9d3519a3815264c6 (diff)
downloadchromium_src-f164cea41472f9e9ec21579233e2c42a7b9d5184.zip
chromium_src-f164cea41472f9e9ec21579233e2c42a7b9d5184.tar.gz
chromium_src-f164cea41472f9e9ec21579233e2c42a7b9d5184.tar.bz2
Mac: Implement about:memory.
This implements about:memory on Mac. It calls /bin/ps to obtain information about processes (this is Apple's officially supported "API"). Unfortunately, ps provides fairly minimal information (rss and vsize); top is better, but not a stable API -- it has changed greatly between Mac OS 10.5 and 10.6, and moreover the 10.6 version is more limited in its output formatting. BUG=9653 TEST=Go to about:memory under a variety of conditions (with a variety of browsers loaded). Review URL: http://codereview.chromium.org/333008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31168 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/memory_details.cc')
-rw-r--r--chrome/browser/memory_details.cc55
1 files changed, 30 insertions, 25 deletions
diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc
index 4ea4444..9953442a 100644
--- a/chrome/browser/memory_details.cc
+++ b/chrome/browser/memory_details.cc
@@ -184,31 +184,34 @@ void MemoryDetails::UpdateHistograms() {
int sample = static_cast<int>(browser.processes[index].working_set.priv);
aggregate_memory += sample;
switch (browser.processes[index].type) {
- case ChildProcessInfo::BROWSER_PROCESS:
- UMA_HISTOGRAM_MEMORY_KB("Memory.Browser", sample);
- break;
- case ChildProcessInfo::RENDER_PROCESS:
- UMA_HISTOGRAM_MEMORY_KB("Memory.Renderer", sample);
- break;
- case ChildProcessInfo::PLUGIN_PROCESS:
- UMA_HISTOGRAM_MEMORY_KB("Memory.Plugin", sample);
- plugin_count++;
- break;
- case ChildProcessInfo::WORKER_PROCESS:
- UMA_HISTOGRAM_MEMORY_KB("Memory.Worker", sample);
- worker_count++;
- break;
- case ChildProcessInfo::ZYGOTE_PROCESS:
- UMA_HISTOGRAM_MEMORY_KB("Memory.Zygote", sample);
- break;
- case ChildProcessInfo::SANDBOX_HELPER_PROCESS:
- UMA_HISTOGRAM_MEMORY_KB("Memory.SandboxHelper", sample);
- break;
- case ChildProcessInfo::NACL_PROCESS:
- UMA_HISTOGRAM_MEMORY_KB("Memory.NativeClient", sample);
- break;
- default:
- NOTREACHED();
+ case ChildProcessInfo::BROWSER_PROCESS:
+ UMA_HISTOGRAM_MEMORY_KB("Memory.Browser", sample);
+ break;
+ case ChildProcessInfo::RENDER_PROCESS:
+ UMA_HISTOGRAM_MEMORY_KB("Memory.Renderer", sample);
+ break;
+ case ChildProcessInfo::PLUGIN_PROCESS:
+ UMA_HISTOGRAM_MEMORY_KB("Memory.Plugin", sample);
+ plugin_count++;
+ break;
+ case ChildProcessInfo::WORKER_PROCESS:
+ UMA_HISTOGRAM_MEMORY_KB("Memory.Worker", sample);
+ worker_count++;
+ break;
+ case ChildProcessInfo::UTILITY_PROCESS:
+ UMA_HISTOGRAM_MEMORY_KB("Memory.Utility", sample);
+ break;
+ case ChildProcessInfo::ZYGOTE_PROCESS:
+ UMA_HISTOGRAM_MEMORY_KB("Memory.Zygote", sample);
+ break;
+ case ChildProcessInfo::SANDBOX_HELPER_PROCESS:
+ UMA_HISTOGRAM_MEMORY_KB("Memory.SandboxHelper", sample);
+ break;
+ case ChildProcessInfo::NACL_PROCESS:
+ UMA_HISTOGRAM_MEMORY_KB("Memory.NativeClient", sample);
+ break;
+ default:
+ NOTREACHED();
}
}
UMA_HISTOGRAM_MEMORY_KB("Memory.BackingStore",
@@ -218,6 +221,8 @@ void MemoryDetails::UpdateHistograms() {
static_cast<int>(browser.processes.size()));
UMA_HISTOGRAM_COUNTS_100("Memory.PluginProcessCount", plugin_count);
UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count);
+ // TODO(viettrungluu): Do we want separate counts for the other
+ // (platform-specific) process types?
int total_sample = static_cast<int>(aggregate_memory / 1000);
UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample);