summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authordavemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-16 21:55:20 +0000
committerdavemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-16 21:55:20 +0000
commit23deabb766b17dbce4cfa44b7dac8c858d0a3ad7 (patch)
tree70cdb2babd1e0b716ef45dd051758836f93ac162 /chrome/browser
parent10bc54a0e229adf3700c9a7ae525e65472470bf4 (diff)
downloadchromium_src-23deabb766b17dbce4cfa44b7dac8c858d0a3ad7.zip
chromium_src-23deabb766b17dbce4cfa44b7dac8c858d0a3ad7.tar.gz
chromium_src-23deabb766b17dbce4cfa44b7dac8c858d0a3ad7.tar.bz2
Record swap sizes on ChromeOS
BUG=260484 TEST=None R=brettw@chromium.org, jam@chromium.org, jar@chromium.org Review URL: https://codereview.chromium.org/19267012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211857 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/memory_details.cc109
-rw-r--r--chrome/browser/memory_details.h4
2 files changed, 96 insertions, 17 deletions
diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc
index 917e2eb..ef07356 100644
--- a/chrome/browser/memory_details.cc
+++ b/chrome/browser/memory_details.cc
@@ -385,7 +385,7 @@ void MemoryDetails::UpdateHistograms() {
switch (browser.processes[index].process_type) {
case content::PROCESS_TYPE_BROWSER:
UMA_HISTOGRAM_MEMORY_KB("Memory.Browser", sample);
- break;
+ continue;
case content::PROCESS_TYPE_RENDERER: {
ProcessMemoryInformation::RendererProcessType renderer_type =
browser.processes[index].renderer_type;
@@ -393,66 +393,65 @@ void MemoryDetails::UpdateHistograms() {
case ProcessMemoryInformation::RENDERER_EXTENSION:
UMA_HISTOGRAM_MEMORY_KB("Memory.Extension", sample);
extension_count++;
- break;
+ continue;
case ProcessMemoryInformation::RENDERER_CHROME:
UMA_HISTOGRAM_MEMORY_KB("Memory.Chrome", sample);
chrome_count++;
- break;
+ continue;
case ProcessMemoryInformation::RENDERER_UNKNOWN:
NOTREACHED() << "Unknown renderer process type.";
- break;
+ continue;
case ProcessMemoryInformation::RENDERER_NORMAL:
default:
// TODO(erikkay): Should we bother splitting out the other subtypes?
UMA_HISTOGRAM_MEMORY_KB("Memory.Renderer", sample);
renderer_count++;
- break;
+ continue;
}
- break;
}
case content::PROCESS_TYPE_PLUGIN:
UMA_HISTOGRAM_MEMORY_KB("Memory.Plugin", sample);
plugin_count++;
- break;
+ continue;
case content::PROCESS_TYPE_WORKER:
UMA_HISTOGRAM_MEMORY_KB("Memory.Worker", sample);
worker_count++;
- break;
+ continue;
case content::PROCESS_TYPE_UTILITY:
UMA_HISTOGRAM_MEMORY_KB("Memory.Utility", sample);
other_count++;
- break;
+ continue;
case content::PROCESS_TYPE_ZYGOTE:
UMA_HISTOGRAM_MEMORY_KB("Memory.Zygote", sample);
other_count++;
- break;
+ continue;
case content::PROCESS_TYPE_SANDBOX_HELPER:
UMA_HISTOGRAM_MEMORY_KB("Memory.SandboxHelper", sample);
other_count++;
- break;
+ continue;
case content::PROCESS_TYPE_GPU:
UMA_HISTOGRAM_MEMORY_KB("Memory.Gpu", sample);
other_count++;
- break;
+ continue;
case content::PROCESS_TYPE_PPAPI_PLUGIN:
UMA_HISTOGRAM_MEMORY_KB("Memory.PepperPlugin", sample);
pepper_plugin_count++;
- break;
+ continue;
case content::PROCESS_TYPE_PPAPI_BROKER:
UMA_HISTOGRAM_MEMORY_KB("Memory.PepperPluginBroker", sample);
pepper_plugin_broker_count++;
- break;
+ continue;
case PROCESS_TYPE_NACL_LOADER:
UMA_HISTOGRAM_MEMORY_KB("Memory.NativeClient", sample);
other_count++;
- break;
+ continue;
case PROCESS_TYPE_NACL_BROKER:
UMA_HISTOGRAM_MEMORY_KB("Memory.NativeClientBroker", sample);
other_count++;
- break;
+ continue;
default:
NOTREACHED();
- break;
+ continue;
}
}
UMA_HISTOGRAM_MEMORY_KB("Memory.BackingStore",
@@ -490,4 +489,80 @@ void MemoryDetails::UpdateHistograms() {
int non_renderer_count = browser.processes.size() - all_renderer_count;
SiteDetails::UpdateHistograms(browser.site_data, all_renderer_count,
non_renderer_count);
+#if defined(OS_CHROMEOS)
+ UpdateSwapHistograms();
+#endif
+
+}
+
+#if defined(OS_CHROMEOS)
+void MemoryDetails::UpdateSwapHistograms() {
+ const ProcessData& browser = *ChromeBrowser();
+ size_t aggregate_memory = 0;
+ for (size_t index = 0; index < browser.processes.size(); index++) {
+ int sample = static_cast<int>(browser.processes[index].working_set.swapped);
+ aggregate_memory += sample;
+ switch (browser.processes[index].process_type) {
+ case content::PROCESS_TYPE_BROWSER:
+ UMA_HISTOGRAM_MEMORY_KB("Memory.Swap.Browser", sample);
+ continue;
+ case content::PROCESS_TYPE_RENDERER: {
+ ProcessMemoryInformation::RendererProcessType renderer_type =
+ browser.processes[index].renderer_type;
+ switch (renderer_type) {
+ case ProcessMemoryInformation::RENDERER_EXTENSION:
+ UMA_HISTOGRAM_MEMORY_KB("Memory.Swap.Extension", sample);
+ continue;
+ case ProcessMemoryInformation::RENDERER_CHROME:
+ UMA_HISTOGRAM_MEMORY_KB("Memory.Swap.Chrome", sample);
+ continue;
+ case ProcessMemoryInformation::RENDERER_UNKNOWN:
+ NOTREACHED() << "Unknown renderer process type.";
+ continue;
+ case ProcessMemoryInformation::RENDERER_NORMAL:
+ default:
+ UMA_HISTOGRAM_MEMORY_KB("Memory.Swap.Renderer", sample);
+ continue;
+ }
+ }
+ case content::PROCESS_TYPE_PLUGIN:
+ UMA_HISTOGRAM_MEMORY_KB("Memory.Swap.Plugin", sample);
+ continue;
+ case content::PROCESS_TYPE_WORKER:
+ UMA_HISTOGRAM_MEMORY_KB("Memory.Swap.Worker", sample);
+ continue;
+ case content::PROCESS_TYPE_UTILITY:
+ UMA_HISTOGRAM_MEMORY_KB("Memory.Swap.Utility", sample);
+ continue;
+ case content::PROCESS_TYPE_ZYGOTE:
+ UMA_HISTOGRAM_MEMORY_KB("Memory.Swap.Zygote", sample);
+ continue;
+ case content::PROCESS_TYPE_SANDBOX_HELPER:
+ UMA_HISTOGRAM_MEMORY_KB("Memory.Swap.SandboxHelper", sample);
+ continue;
+ case content::PROCESS_TYPE_GPU:
+ UMA_HISTOGRAM_MEMORY_KB("Memory.Swap.Gpu", sample);
+ continue;
+ case content::PROCESS_TYPE_PPAPI_PLUGIN:
+ UMA_HISTOGRAM_MEMORY_KB("Memory.Swap.PepperPlugin", sample);
+ continue;
+ case content::PROCESS_TYPE_PPAPI_BROKER:
+ UMA_HISTOGRAM_MEMORY_KB("Memory.Swap.PepperPluginBroker", sample);
+ continue;
+ case PROCESS_TYPE_NACL_LOADER:
+ UMA_HISTOGRAM_MEMORY_KB("Memory.Swap.NativeClient", sample);
+ continue;
+ case PROCESS_TYPE_NACL_BROKER:
+ UMA_HISTOGRAM_MEMORY_KB("Memory.Swap.NativeClientBroker", sample);
+ continue;
+ default:
+ NOTREACHED();
+ continue;
+ }
+ }
+
+ int total_sample = static_cast<int>(aggregate_memory / 1000);
+ UMA_HISTOGRAM_MEMORY_MB("Memory.Swap.Total", total_sample);
}
+
+#endif
diff --git a/chrome/browser/memory_details.h b/chrome/browser/memory_details.h
index 89692e2..24abeb9 100644
--- a/chrome/browser/memory_details.h
+++ b/chrome/browser/memory_details.h
@@ -176,6 +176,10 @@ class MemoryDetails : public base::RefCountedThreadSafe<MemoryDetails> {
// Updates the global histograms for tracking memory usage.
void UpdateHistograms();
+#if defined(OS_CHROMEOS)
+ void UpdateSwapHistograms();
+#endif
+
// Returns a pointer to the ProcessData structure for Chrome.
ProcessData* ChromeBrowser();