Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/metrics/metrics_memory_details.h" | 5 #include "chrome/browser/metrics/metrics_memory_details.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 int pepper_plugin_broker_count = 0; | 82 int pepper_plugin_broker_count = 0; |
| 83 int renderer_count = 0; | 83 int renderer_count = 0; |
| 84 int other_count = 0; | 84 int other_count = 0; |
| 85 int worker_count = 0; | 85 int worker_count = 0; |
| 86 int process_limit = content::RenderProcessHost::GetMaxRendererProcessCount(); | 86 int process_limit = content::RenderProcessHost::GetMaxRendererProcessCount(); |
| 87 for (size_t index = 0; index < browser.processes.size(); index++) { | 87 for (size_t index = 0; index < browser.processes.size(); index++) { |
| 88 int sample = static_cast<int>(browser.processes[index].working_set.priv); | 88 int sample = static_cast<int>(browser.processes[index].working_set.priv); |
| 89 aggregate_memory += sample; | 89 aggregate_memory += sample; |
| 90 switch (browser.processes[index].process_type) { | 90 switch (browser.processes[index].process_type) { |
| 91 case content::PROCESS_TYPE_BROWSER: | 91 case content::PROCESS_TYPE_BROWSER: |
| 92 // TODO(rkaplow): Remove later. This metric is capped at .5GB. | |
|
Ilya Sherman
2016/07/21 22:25:53
nit: Please provide a target milestone, probably "
bashi
2016/07/21 22:29:02
Yes, but I don't know a target milestone. rkaplow@
rkaplow
2016/07/25 18:52:05
You can actually remove the actual recording of th
bashi
2016/07/25 23:43:44
Done.
| |
| 93 UMA_HISTOGRAM_MEMORY_KB("Memory.Browser", sample); | |
| 92 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Browser.Large2", sample / 1024); | 94 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Browser.Large2", sample / 1024); |
| 93 continue; | 95 continue; |
| 94 case content::PROCESS_TYPE_RENDERER: { | 96 case content::PROCESS_TYPE_RENDERER: { |
| 95 ProcessMemoryInformation::RendererProcessType renderer_type = | 97 ProcessMemoryInformation::RendererProcessType renderer_type = |
| 96 browser.processes[index].renderer_type; | 98 browser.processes[index].renderer_type; |
| 97 switch (renderer_type) { | 99 switch (renderer_type) { |
| 98 case ProcessMemoryInformation::RENDERER_EXTENSION: | 100 case ProcessMemoryInformation::RENDERER_EXTENSION: |
| 99 UMA_HISTOGRAM_MEMORY_KB("Memory.Extension", sample); | 101 UMA_HISTOGRAM_MEMORY_KB("Memory.Extension", sample); |
| 100 extension_count++; | 102 extension_count++; |
| 101 continue; | 103 continue; |
| 102 case ProcessMemoryInformation::RENDERER_CHROME: | 104 case ProcessMemoryInformation::RENDERER_CHROME: |
| 103 UMA_HISTOGRAM_MEMORY_KB("Memory.Chrome", sample); | 105 UMA_HISTOGRAM_MEMORY_KB("Memory.Chrome", sample); |
| 104 chrome_count++; | 106 chrome_count++; |
| 105 continue; | 107 continue; |
| 106 case ProcessMemoryInformation::RENDERER_UNKNOWN: | 108 case ProcessMemoryInformation::RENDERER_UNKNOWN: |
| 107 NOTREACHED() << "Unknown renderer process type."; | 109 NOTREACHED() << "Unknown renderer process type."; |
| 108 continue; | 110 continue; |
| 109 case ProcessMemoryInformation::RENDERER_NORMAL: | 111 case ProcessMemoryInformation::RENDERER_NORMAL: |
| 110 default: | 112 default: |
| 113 // TODO(rkaplow): Remove later. This metric is capped at .5GB. | |
|
Ilya Sherman
2016/07/21 22:25:53
Ditto.
| |
| 114 UMA_HISTOGRAM_MEMORY_KB("Memory.Renderer", sample); | |
| 111 // TODO(erikkay): Should we bother splitting out the other subtypes? | 115 // TODO(erikkay): Should we bother splitting out the other subtypes? |
| 112 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Renderer.Large2", | 116 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Renderer.Large2", |
| 113 sample / 1024); | 117 sample / 1024); |
| 114 int diff; | 118 int diff; |
| 115 if (memory_growth_tracker_ && | 119 if (memory_growth_tracker_ && |
| 116 memory_growth_tracker_->UpdateSample( | 120 memory_growth_tracker_->UpdateSample( |
| 117 browser.processes[index].pid, sample, &diff)) { | 121 browser.processes[index].pid, sample, &diff)) { |
| 118 if (diff < 0) | 122 if (diff < 0) |
| 119 UMA_HISTOGRAM_MEMORY_KB("Memory.RendererShrinkIn30Min", -diff); | 123 UMA_HISTOGRAM_MEMORY_KB("Memory.RendererShrinkIn30Min", -diff); |
| 120 else | 124 else |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 298 UMA_HISTOGRAM_CUSTOM_COUNTS("Memory.Swap.NumWrites", swap_info().num_writes, | 302 UMA_HISTOGRAM_CUSTOM_COUNTS("Memory.Swap.NumWrites", swap_info().num_writes, |
| 299 1, 100000000, 100); | 303 1, 100000000, 100); |
| 300 | 304 |
| 301 if (swap_info().orig_data_size > 0 && swap_info().compr_data_size > 0) { | 305 if (swap_info().orig_data_size > 0 && swap_info().compr_data_size > 0) { |
| 302 UMA_HISTOGRAM_CUSTOM_COUNTS( | 306 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 303 "Memory.Swap.CompressionRatio", | 307 "Memory.Swap.CompressionRatio", |
| 304 swap_info().orig_data_size / swap_info().compr_data_size, 1, 20, 20); | 308 swap_info().orig_data_size / swap_info().compr_data_size, 1, 20, 20); |
| 305 } | 309 } |
| 306 } | 310 } |
| 307 #endif // defined(OS_CHROMEOS) | 311 #endif // defined(OS_CHROMEOS) |
| OLD | NEW |