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

Side by Side Diff: chrome/browser/metrics/metrics_memory_details.cc

Issue 1862513003: Remove NPAPI from browser and utility (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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
OLDNEW
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } 71 }
72 72
73 void MetricsMemoryDetails::UpdateHistograms() { 73 void MetricsMemoryDetails::UpdateHistograms() {
74 // Reports a set of memory metrics to UMA. 74 // Reports a set of memory metrics to UMA.
75 // Memory is measured in KB. 75 // Memory is measured in KB.
76 76
77 const ProcessData& browser = *ChromeBrowser(); 77 const ProcessData& browser = *ChromeBrowser();
78 size_t aggregate_memory = 0; 78 size_t aggregate_memory = 0;
79 int chrome_count = 0; 79 int chrome_count = 0;
80 int extension_count = 0; 80 int extension_count = 0;
81 int plugin_count = 0;
82 int pepper_plugin_count = 0; 81 int pepper_plugin_count = 0;
83 int pepper_plugin_broker_count = 0; 82 int pepper_plugin_broker_count = 0;
84 int renderer_count = 0; 83 int renderer_count = 0;
85 int other_count = 0; 84 int other_count = 0;
86 int worker_count = 0; 85 int worker_count = 0;
87 int process_limit = content::RenderProcessHost::GetMaxRendererProcessCount(); 86 int process_limit = content::RenderProcessHost::GetMaxRendererProcessCount();
88 for (size_t index = 0; index < browser.processes.size(); index++) { 87 for (size_t index = 0; index < browser.processes.size(); index++) {
89 int sample = static_cast<int>(browser.processes[index].working_set.priv); 88 int sample = static_cast<int>(browser.processes[index].working_set.priv);
90 aggregate_memory += sample; 89 aggregate_memory += sample;
91 switch (browser.processes[index].process_type) { 90 switch (browser.processes[index].process_type) {
(...skipping 25 matching lines...) Expand all
117 browser.processes[index].pid, sample, &diff)) { 116 browser.processes[index].pid, sample, &diff)) {
118 if (diff < 0) 117 if (diff < 0)
119 UMA_HISTOGRAM_MEMORY_KB("Memory.RendererShrinkIn30Min", -diff); 118 UMA_HISTOGRAM_MEMORY_KB("Memory.RendererShrinkIn30Min", -diff);
120 else 119 else
121 UMA_HISTOGRAM_MEMORY_KB("Memory.RendererGrowthIn30Min", diff); 120 UMA_HISTOGRAM_MEMORY_KB("Memory.RendererGrowthIn30Min", diff);
122 } 121 }
123 renderer_count++; 122 renderer_count++;
124 continue; 123 continue;
125 } 124 }
126 } 125 }
127 case content::PROCESS_TYPE_PLUGIN:
128 UMA_HISTOGRAM_MEMORY_KB("Memory.Plugin", sample);
129 plugin_count++;
130 continue;
131 case content::PROCESS_TYPE_UTILITY: 126 case content::PROCESS_TYPE_UTILITY:
132 UMA_HISTOGRAM_MEMORY_KB("Memory.Utility", sample); 127 UMA_HISTOGRAM_MEMORY_KB("Memory.Utility", sample);
133 other_count++; 128 other_count++;
134 continue; 129 continue;
135 case content::PROCESS_TYPE_ZYGOTE: 130 case content::PROCESS_TYPE_ZYGOTE:
136 UMA_HISTOGRAM_MEMORY_KB("Memory.Zygote", sample); 131 UMA_HISTOGRAM_MEMORY_KB("Memory.Zygote", sample);
137 other_count++; 132 other_count++;
138 continue; 133 continue;
139 case content::PROCESS_TYPE_SANDBOX_HELPER: 134 case content::PROCESS_TYPE_SANDBOX_HELPER:
140 UMA_HISTOGRAM_MEMORY_KB("Memory.SandboxHelper", sample); 135 UMA_HISTOGRAM_MEMORY_KB("Memory.SandboxHelper", sample);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 if (base::GetSystemMemoryInfo(&meminfo) && meminfo.gem_size != -1) 176 if (base::GetSystemMemoryInfo(&meminfo) && meminfo.gem_size != -1)
182 UMA_HISTOGRAM_MEMORY_MB("Memory.Graphics", meminfo.gem_size / 1024 / 1024); 177 UMA_HISTOGRAM_MEMORY_MB("Memory.Graphics", meminfo.gem_size / 1024 / 1024);
183 #endif 178 #endif
184 179
185 UMA_HISTOGRAM_COUNTS_100("Memory.ProcessLimit", process_limit); 180 UMA_HISTOGRAM_COUNTS_100("Memory.ProcessLimit", process_limit);
186 UMA_HISTOGRAM_COUNTS_100("Memory.ProcessCount", 181 UMA_HISTOGRAM_COUNTS_100("Memory.ProcessCount",
187 static_cast<int>(browser.processes.size())); 182 static_cast<int>(browser.processes.size()));
188 UMA_HISTOGRAM_COUNTS_100("Memory.ChromeProcessCount", chrome_count); 183 UMA_HISTOGRAM_COUNTS_100("Memory.ChromeProcessCount", chrome_count);
189 UMA_HISTOGRAM_COUNTS_100("Memory.ExtensionProcessCount", extension_count); 184 UMA_HISTOGRAM_COUNTS_100("Memory.ExtensionProcessCount", extension_count);
190 UMA_HISTOGRAM_COUNTS_100("Memory.OtherProcessCount", other_count); 185 UMA_HISTOGRAM_COUNTS_100("Memory.OtherProcessCount", other_count);
191 UMA_HISTOGRAM_COUNTS_100("Memory.PluginProcessCount", plugin_count);
192 UMA_HISTOGRAM_COUNTS_100("Memory.PepperPluginProcessCount", 186 UMA_HISTOGRAM_COUNTS_100("Memory.PepperPluginProcessCount",
193 pepper_plugin_count); 187 pepper_plugin_count);
194 UMA_HISTOGRAM_COUNTS_100("Memory.PepperPluginBrokerProcessCount", 188 UMA_HISTOGRAM_COUNTS_100("Memory.PepperPluginBrokerProcessCount",
195 pepper_plugin_broker_count); 189 pepper_plugin_broker_count);
196 UMA_HISTOGRAM_COUNTS_100("Memory.RendererProcessCount", renderer_count); 190 UMA_HISTOGRAM_COUNTS_100("Memory.RendererProcessCount", renderer_count);
197 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count); 191 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count);
198 // TODO(viettrungluu): Do we want separate counts for the other 192 // TODO(viettrungluu): Do we want separate counts for the other
199 // (platform-specific) process types? 193 // (platform-specific) process types?
200 194
201 // TODO(rkaplow): Remove once we've verified Memory.Total2 is ok. 195 // TODO(rkaplow): Remove once we've verified Memory.Total2 is ok.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 continue; 240 continue;
247 case ProcessMemoryInformation::RENDERER_UNKNOWN: 241 case ProcessMemoryInformation::RENDERER_UNKNOWN:
248 NOTREACHED() << "Unknown renderer process type."; 242 NOTREACHED() << "Unknown renderer process type.";
249 continue; 243 continue;
250 case ProcessMemoryInformation::RENDERER_NORMAL: 244 case ProcessMemoryInformation::RENDERER_NORMAL:
251 default: 245 default:
252 UMA_HISTOGRAM_MEMORY_KB("Memory.Swap.Renderer", sample); 246 UMA_HISTOGRAM_MEMORY_KB("Memory.Swap.Renderer", sample);
253 continue; 247 continue;
254 } 248 }
255 } 249 }
256 case content::PROCESS_TYPE_PLUGIN:
257 UMA_HISTOGRAM_MEMORY_KB("Memory.Swap.Plugin", sample);
258 continue;
259 case content::PROCESS_TYPE_UTILITY: 250 case content::PROCESS_TYPE_UTILITY:
260 UMA_HISTOGRAM_MEMORY_KB("Memory.Swap.Utility", sample); 251 UMA_HISTOGRAM_MEMORY_KB("Memory.Swap.Utility", sample);
261 continue; 252 continue;
262 case content::PROCESS_TYPE_ZYGOTE: 253 case content::PROCESS_TYPE_ZYGOTE:
263 UMA_HISTOGRAM_MEMORY_KB("Memory.Swap.Zygote", sample); 254 UMA_HISTOGRAM_MEMORY_KB("Memory.Swap.Zygote", sample);
264 continue; 255 continue;
265 case content::PROCESS_TYPE_SANDBOX_HELPER: 256 case content::PROCESS_TYPE_SANDBOX_HELPER:
266 UMA_HISTOGRAM_MEMORY_KB("Memory.Swap.SandboxHelper", sample); 257 UMA_HISTOGRAM_MEMORY_KB("Memory.Swap.SandboxHelper", sample);
267 continue; 258 continue;
268 case content::PROCESS_TYPE_GPU: 259 case content::PROCESS_TYPE_GPU:
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 UMA_HISTOGRAM_CUSTOM_COUNTS("Memory.Swap.NumWrites", swap_info().num_writes, 297 UMA_HISTOGRAM_CUSTOM_COUNTS("Memory.Swap.NumWrites", swap_info().num_writes,
307 1, 100000000, 100); 298 1, 100000000, 100);
308 299
309 if (swap_info().orig_data_size > 0 && swap_info().compr_data_size > 0) { 300 if (swap_info().orig_data_size > 0 && swap_info().compr_data_size > 0) {
310 UMA_HISTOGRAM_CUSTOM_COUNTS( 301 UMA_HISTOGRAM_CUSTOM_COUNTS(
311 "Memory.Swap.CompressionRatio", 302 "Memory.Swap.CompressionRatio",
312 swap_info().orig_data_size / swap_info().compr_data_size, 1, 20, 20); 303 swap_info().orig_data_size / swap_info().compr_data_size, 1, 20, 20);
313 } 304 }
314 } 305 }
315 #endif // defined(OS_CHROMEOS) 306 #endif // defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698