OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_version_info.h" | 8 #include "base/file_version_info.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 void MemoryDetails::UpdateHistograms() { | 364 void MemoryDetails::UpdateHistograms() { |
365 // Reports a set of memory metrics to UMA. | 365 // Reports a set of memory metrics to UMA. |
366 // Memory is measured in KB. | 366 // Memory is measured in KB. |
367 | 367 |
368 const ProcessData& browser = *ChromeBrowser(); | 368 const ProcessData& browser = *ChromeBrowser(); |
369 size_t aggregate_memory = 0; | 369 size_t aggregate_memory = 0; |
370 int chrome_count = 0; | 370 int chrome_count = 0; |
371 int extension_count = 0; | 371 int extension_count = 0; |
372 int plugin_count = 0; | 372 int plugin_count = 0; |
373 int pepper_plugin_count = 0; | 373 int pepper_plugin_count = 0; |
| 374 int pepper_plugin_broker_count = 0; |
374 int renderer_count = 0; | 375 int renderer_count = 0; |
375 int other_count = 0; | 376 int other_count = 0; |
376 int worker_count = 0; | 377 int worker_count = 0; |
377 for (size_t index = 0; index < browser.processes.size(); index++) { | 378 for (size_t index = 0; index < browser.processes.size(); index++) { |
378 int sample = static_cast<int>(browser.processes[index].working_set.priv); | 379 int sample = static_cast<int>(browser.processes[index].working_set.priv); |
379 aggregate_memory += sample; | 380 aggregate_memory += sample; |
380 switch (browser.processes[index].type) { | 381 switch (browser.processes[index].type) { |
381 case content::PROCESS_TYPE_BROWSER: | 382 case content::PROCESS_TYPE_BROWSER: |
382 UMA_HISTOGRAM_MEMORY_KB("Memory.Browser", sample); | 383 UMA_HISTOGRAM_MEMORY_KB("Memory.Browser", sample); |
383 break; | 384 break; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 other_count++; | 435 other_count++; |
435 break; | 436 break; |
436 case content::PROCESS_TYPE_GPU: | 437 case content::PROCESS_TYPE_GPU: |
437 UMA_HISTOGRAM_MEMORY_KB("Memory.Gpu", sample); | 438 UMA_HISTOGRAM_MEMORY_KB("Memory.Gpu", sample); |
438 other_count++; | 439 other_count++; |
439 break; | 440 break; |
440 case content::PROCESS_TYPE_PPAPI_PLUGIN: | 441 case content::PROCESS_TYPE_PPAPI_PLUGIN: |
441 UMA_HISTOGRAM_MEMORY_KB("Memory.PepperPlugin", sample); | 442 UMA_HISTOGRAM_MEMORY_KB("Memory.PepperPlugin", sample); |
442 pepper_plugin_count++; | 443 pepper_plugin_count++; |
443 break; | 444 break; |
| 445 case content::PROCESS_TYPE_PPAPI_BROKER: |
| 446 UMA_HISTOGRAM_MEMORY_KB("Memory.PepperPluginBroker", sample); |
| 447 pepper_plugin_broker_count++; |
| 448 break; |
444 default: | 449 default: |
445 NOTREACHED(); | 450 NOTREACHED(); |
446 break; | 451 break; |
447 } | 452 } |
448 } | 453 } |
449 UMA_HISTOGRAM_MEMORY_KB("Memory.BackingStore", | 454 UMA_HISTOGRAM_MEMORY_KB("Memory.BackingStore", |
450 RenderWidgetHost::BackingStoreMemorySize() / 1024); | 455 RenderWidgetHost::BackingStoreMemorySize() / 1024); |
451 | 456 |
452 UMA_HISTOGRAM_COUNTS_100("Memory.ProcessCount", | 457 UMA_HISTOGRAM_COUNTS_100("Memory.ProcessCount", |
453 static_cast<int>(browser.processes.size())); | 458 static_cast<int>(browser.processes.size())); |
454 UMA_HISTOGRAM_COUNTS_100("Memory.ChromeProcessCount", chrome_count); | 459 UMA_HISTOGRAM_COUNTS_100("Memory.ChromeProcessCount", chrome_count); |
455 UMA_HISTOGRAM_COUNTS_100("Memory.ExtensionProcessCount", extension_count); | 460 UMA_HISTOGRAM_COUNTS_100("Memory.ExtensionProcessCount", extension_count); |
456 UMA_HISTOGRAM_COUNTS_100("Memory.OtherProcessCount", other_count); | 461 UMA_HISTOGRAM_COUNTS_100("Memory.OtherProcessCount", other_count); |
457 UMA_HISTOGRAM_COUNTS_100("Memory.PluginProcessCount", plugin_count); | 462 UMA_HISTOGRAM_COUNTS_100("Memory.PluginProcessCount", plugin_count); |
458 UMA_HISTOGRAM_COUNTS_100("Memory.PepperPluginProcessCount", | 463 UMA_HISTOGRAM_COUNTS_100("Memory.PepperPluginProcessCount", |
459 pepper_plugin_count); | 464 pepper_plugin_count); |
| 465 UMA_HISTOGRAM_COUNTS_100("Memory.PepperPluginBrokerProcessCount", |
| 466 pepper_plugin_broker_count); |
460 UMA_HISTOGRAM_COUNTS_100("Memory.RendererProcessCount", renderer_count); | 467 UMA_HISTOGRAM_COUNTS_100("Memory.RendererProcessCount", renderer_count); |
461 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count); | 468 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count); |
462 // TODO(viettrungluu): Do we want separate counts for the other | 469 // TODO(viettrungluu): Do we want separate counts for the other |
463 // (platform-specific) process types? | 470 // (platform-specific) process types? |
464 | 471 |
465 int total_sample = static_cast<int>(aggregate_memory / 1000); | 472 int total_sample = static_cast<int>(aggregate_memory / 1000); |
466 UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample); | 473 UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample); |
467 } | 474 } |
OLD | NEW |