Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: chrome/browser/memory_details.cc

Issue 165538: cap the number of tabs in the backing store cache (Closed)
Patch Set: fix git weird upload Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/renderer_host/backing_store_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/memory_details.h" 5 #include "chrome/browser/memory_details.h"
6 #include <psapi.h> 6 #include <psapi.h>
7 7
8 #include "app/l10n_util.h" 8 #include "app/l10n_util.h"
9 #include "base/file_version_info.h" 9 #include "base/file_version_info.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/chrome_thread.h" 12 #include "chrome/browser/chrome_thread.h"
13 #include "chrome/browser/renderer_host/backing_store_manager.h"
13 #include "chrome/browser/renderer_host/render_process_host.h" 14 #include "chrome/browser/renderer_host/render_process_host.h"
14 #include "chrome/browser/tab_contents/navigation_entry.h" 15 #include "chrome/browser/tab_contents/navigation_entry.h"
15 #include "chrome/browser/tab_contents/tab_contents.h" 16 #include "chrome/browser/tab_contents/tab_contents.h"
16 #include "chrome/common/child_process_host.h" 17 #include "chrome/common/child_process_host.h"
17 #include "chrome/common/url_constants.h" 18 #include "chrome/common/url_constants.h"
18 #include "grit/chromium_strings.h" 19 #include "grit/chromium_strings.h"
19 20
20 class RenderViewHostDelegate; 21 class RenderViewHostDelegate;
21 22
22 // Template of static data we use for finding browser process information. 23 // Template of static data we use for finding browser process information.
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 } 270 }
270 } 271 }
271 272
272 UpdateHistograms(); 273 UpdateHistograms();
273 274
274 OnDetailsAvailable(); 275 OnDetailsAvailable();
275 } 276 }
276 277
277 void MemoryDetails::UpdateHistograms() { 278 void MemoryDetails::UpdateHistograms() {
278 // Reports a set of memory metrics to UMA. 279 // Reports a set of memory metrics to UMA.
279 // Memory is measured in units of 10KB. 280 // Memory is measured in KB.
280 281
281 ProcessData browser = process_data_[CHROME_BROWSER]; 282 ProcessData browser = process_data_[CHROME_BROWSER];
282 size_t aggregate_memory = 0; 283 size_t aggregate_memory = 0;
283 int plugin_count = 0; 284 int plugin_count = 0;
284 int worker_count = 0; 285 int worker_count = 0;
285 for (size_t index = 0; index < browser.processes.size(); index++) { 286 for (size_t index = 0; index < browser.processes.size(); index++) {
286 int sample = static_cast<int>(browser.processes[index].working_set.priv); 287 int sample = static_cast<int>(browser.processes[index].working_set.priv);
287 aggregate_memory += sample; 288 aggregate_memory += sample;
288 switch (browser.processes[index].type) { 289 switch (browser.processes[index].type) {
289 case ChildProcessInfo::BROWSER_PROCESS: 290 case ChildProcessInfo::BROWSER_PROCESS:
290 UMA_HISTOGRAM_MEMORY_KB("Memory.Browser", sample); 291 UMA_HISTOGRAM_MEMORY_KB("Memory.Browser", sample);
291 break; 292 break;
292 case ChildProcessInfo::RENDER_PROCESS: 293 case ChildProcessInfo::RENDER_PROCESS:
293 UMA_HISTOGRAM_MEMORY_KB("Memory.Renderer", sample); 294 UMA_HISTOGRAM_MEMORY_KB("Memory.Renderer", sample);
294 break; 295 break;
295 case ChildProcessInfo::PLUGIN_PROCESS: 296 case ChildProcessInfo::PLUGIN_PROCESS:
296 UMA_HISTOGRAM_MEMORY_KB("Memory.Plugin", sample); 297 UMA_HISTOGRAM_MEMORY_KB("Memory.Plugin", sample);
297 plugin_count++; 298 plugin_count++;
298 break; 299 break;
299 case ChildProcessInfo::WORKER_PROCESS: 300 case ChildProcessInfo::WORKER_PROCESS:
300 UMA_HISTOGRAM_MEMORY_KB("Memory.Worker", sample); 301 UMA_HISTOGRAM_MEMORY_KB("Memory.Worker", sample);
301 worker_count++; 302 worker_count++;
302 break; 303 break;
303 } 304 }
304 } 305 }
306 UMA_HISTOGRAM_MEMORY_KB("Memory.BackingStore",
307 BackingStoreManager::MemorySize() / 1024);
305 308
306 UMA_HISTOGRAM_COUNTS_100("Memory.ProcessCount", 309 UMA_HISTOGRAM_COUNTS_100("Memory.ProcessCount",
307 static_cast<int>(browser.processes.size())); 310 static_cast<int>(browser.processes.size()));
308 UMA_HISTOGRAM_COUNTS_100("Memory.PluginProcessCount", plugin_count); 311 UMA_HISTOGRAM_COUNTS_100("Memory.PluginProcessCount", plugin_count);
309 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count); 312 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count);
310 313
311 int total_sample = static_cast<int>(aggregate_memory / 1000); 314 int total_sample = static_cast<int>(aggregate_memory / 1000);
312 UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample); 315 UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample);
313 } 316 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/renderer_host/backing_store_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698