diff options
author | jar@google.com <jar@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-21 22:30:55 +0000 |
---|---|---|
committer | jar@google.com <jar@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-21 22:30:55 +0000 |
commit | 921cd0cc14715c394d4429d8f5e520a8933fee15 (patch) | |
tree | 5ed6ce1dd0070df365a32df4a5d46128b405596c /chrome/browser/memory_details.cc | |
parent | b6674a2d9d3196169b5be1bbf706effe6d9bdda4 (diff) | |
download | chromium_src-921cd0cc14715c394d4429d8f5e520a8933fee15.zip chromium_src-921cd0cc14715c394d4429d8f5e520a8933fee15.tar.gz chromium_src-921cd0cc14715c394d4429d8f5e520a8933fee15.tar.bz2 |
Create memory histograms that also depend on the memory-model experiment
The experiment was set up to measure tab switch time impact, and this
mod will allow us to see the impact on user memory (and user perception of
memory).
r=mbelshe
Review URL: http://codereview.chromium.org/8027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3696 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/memory_details.cc')
-rw-r--r-- | chrome/browser/memory_details.cc | 46 |
1 files changed, 36 insertions, 10 deletions
diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc index e235fe5..de73f9c 100644 --- a/chrome/browser/memory_details.cc +++ b/chrome/browser/memory_details.cc @@ -12,6 +12,7 @@ #include "base/process_util.h" #include "base/thread.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/browser_trial.h" #include "chrome/browser/plugin_process_host.h" #include "chrome/browser/plugin_service.h" #include "chrome/browser/render_process_host.h" @@ -221,34 +222,59 @@ void MemoryDetails::UpdateHistograms() { // Reports a set of memory metrics to UMA. // Memory is measured in units of 10KB. + // If field trial is active, report results in special histograms. + static scoped_refptr<FieldTrial> trial( + FieldTrialList::Find(BrowserTrial::kMemoryModelFieldTrial)); + DWORD browser_pid = GetCurrentProcessId(); ProcessData browser = process_data_[CHROME_BROWSER]; size_t aggregate_memory = 0; for (size_t index = 0; index < browser.processes.size(); index++) { - aggregate_memory += browser.processes[index].working_set.priv; + int sample = static_cast<int>(browser.processes[index].working_set.priv); + aggregate_memory += sample; if (browser.processes[index].pid == browser_pid) { - UMA_HISTOGRAM_MEMORY_KB(L"Memory.Browser", - static_cast<int>(browser.processes[index].working_set.priv)); + if (trial.get()) { + if (trial->boolean_value()) + UMA_HISTOGRAM_MEMORY_KB(L"Memory.Browser_trial_high_memory", sample); + else + UMA_HISTOGRAM_MEMORY_KB(L"Memory.Browser_trial_med_memory", sample); + } else { + UMA_HISTOGRAM_MEMORY_KB(L"Memory.Browser", sample); + } } else { bool is_plugin_process = false; for (size_t index2 = 0; index2 < plugins_.size(); index2++) { if (browser.processes[index].pid == plugins_[index2].pid) { - UMA_HISTOGRAM_MEMORY_KB(L"Memory.Plugin", - static_cast<int>(browser.processes[index].working_set.priv)); + UMA_HISTOGRAM_MEMORY_KB(L"Memory.Plugin", sample); is_plugin_process = true; break; } } - if (!is_plugin_process) - UMA_HISTOGRAM_MEMORY_KB(L"Memory.Renderer", - static_cast<int>(browser.processes[index].working_set.priv)); + if (!is_plugin_process) { + if (trial.get()) { + if (trial->boolean_value()) + UMA_HISTOGRAM_MEMORY_KB(L"Memory.Renderer_high_memory", sample); + else + UMA_HISTOGRAM_MEMORY_KB(L"Memory.Renderer_med_memory", sample); + } else { + UMA_HISTOGRAM_MEMORY_KB(L"Memory.Renderer", sample); + } + } } } UMA_HISTOGRAM_COUNTS_100(L"Memory.ProcessCount", static_cast<int>(browser.processes.size())); UMA_HISTOGRAM_COUNTS_100(L"Memory.PluginProcessCount", static_cast<int>(plugins_.size())); - UMA_HISTOGRAM_MEMORY_MB(L"Memory.Total", - static_cast<int>(aggregate_memory / 1000)); + + int total_sample = static_cast<int>(aggregate_memory / 1000); + if (trial.get()) { + if (trial->boolean_value()) + UMA_HISTOGRAM_MEMORY_MB(L"Memory.Total_trial_high_memory", total_sample); + else + UMA_HISTOGRAM_MEMORY_MB(L"Memory.Total_trial_med_memory", total_sample); + } else { + UMA_HISTOGRAM_MEMORY_MB(L"Memory.Total", total_sample); + } } |