OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/file_version_info.h" | 8 #include "base/file_version_info.h" |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // Memory is measured in KB. | 177 // Memory is measured in KB. |
178 | 178 |
179 const ProcessData& browser = *ChromeBrowser(); | 179 const ProcessData& browser = *ChromeBrowser(); |
180 size_t aggregate_memory = 0; | 180 size_t aggregate_memory = 0; |
181 int plugin_count = 0; | 181 int plugin_count = 0; |
182 int worker_count = 0; | 182 int worker_count = 0; |
183 for (size_t index = 0; index < browser.processes.size(); index++) { | 183 for (size_t index = 0; index < browser.processes.size(); index++) { |
184 int sample = static_cast<int>(browser.processes[index].working_set.priv); | 184 int sample = static_cast<int>(browser.processes[index].working_set.priv); |
185 aggregate_memory += sample; | 185 aggregate_memory += sample; |
186 switch (browser.processes[index].type) { | 186 switch (browser.processes[index].type) { |
187 case ChildProcessInfo::BROWSER_PROCESS: | 187 case ChildProcessInfo::BROWSER_PROCESS: |
188 UMA_HISTOGRAM_MEMORY_KB("Memory.Browser", sample); | 188 UMA_HISTOGRAM_MEMORY_KB("Memory.Browser", sample); |
189 break; | 189 break; |
190 case ChildProcessInfo::RENDER_PROCESS: | 190 case ChildProcessInfo::RENDER_PROCESS: |
191 UMA_HISTOGRAM_MEMORY_KB("Memory.Renderer", sample); | 191 UMA_HISTOGRAM_MEMORY_KB("Memory.Renderer", sample); |
192 break; | 192 break; |
193 case ChildProcessInfo::PLUGIN_PROCESS: | 193 case ChildProcessInfo::PLUGIN_PROCESS: |
194 UMA_HISTOGRAM_MEMORY_KB("Memory.Plugin", sample); | 194 UMA_HISTOGRAM_MEMORY_KB("Memory.Plugin", sample); |
195 plugin_count++; | 195 plugin_count++; |
196 break; | 196 break; |
197 case ChildProcessInfo::WORKER_PROCESS: | 197 case ChildProcessInfo::WORKER_PROCESS: |
198 UMA_HISTOGRAM_MEMORY_KB("Memory.Worker", sample); | 198 UMA_HISTOGRAM_MEMORY_KB("Memory.Worker", sample); |
199 worker_count++; | 199 worker_count++; |
200 break; | 200 break; |
201 case ChildProcessInfo::ZYGOTE_PROCESS: | 201 case ChildProcessInfo::UTILITY_PROCESS: |
202 UMA_HISTOGRAM_MEMORY_KB("Memory.Zygote", sample); | 202 UMA_HISTOGRAM_MEMORY_KB("Memory.Utility", sample); |
203 break; | 203 break; |
204 case ChildProcessInfo::SANDBOX_HELPER_PROCESS: | 204 case ChildProcessInfo::ZYGOTE_PROCESS: |
205 UMA_HISTOGRAM_MEMORY_KB("Memory.SandboxHelper", sample); | 205 UMA_HISTOGRAM_MEMORY_KB("Memory.Zygote", sample); |
206 break; | 206 break; |
207 case ChildProcessInfo::NACL_PROCESS: | 207 case ChildProcessInfo::SANDBOX_HELPER_PROCESS: |
208 UMA_HISTOGRAM_MEMORY_KB("Memory.NativeClient", sample); | 208 UMA_HISTOGRAM_MEMORY_KB("Memory.SandboxHelper", sample); |
209 break; | 209 break; |
210 default: | 210 case ChildProcessInfo::NACL_PROCESS: |
211 NOTREACHED(); | 211 UMA_HISTOGRAM_MEMORY_KB("Memory.NativeClient", sample); |
| 212 break; |
| 213 default: |
| 214 NOTREACHED(); |
212 } | 215 } |
213 } | 216 } |
214 UMA_HISTOGRAM_MEMORY_KB("Memory.BackingStore", | 217 UMA_HISTOGRAM_MEMORY_KB("Memory.BackingStore", |
215 BackingStoreManager::MemorySize() / 1024); | 218 BackingStoreManager::MemorySize() / 1024); |
216 | 219 |
217 UMA_HISTOGRAM_COUNTS_100("Memory.ProcessCount", | 220 UMA_HISTOGRAM_COUNTS_100("Memory.ProcessCount", |
218 static_cast<int>(browser.processes.size())); | 221 static_cast<int>(browser.processes.size())); |
219 UMA_HISTOGRAM_COUNTS_100("Memory.PluginProcessCount", plugin_count); | 222 UMA_HISTOGRAM_COUNTS_100("Memory.PluginProcessCount", plugin_count); |
220 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count); | 223 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count); |
| 224 // TODO(viettrungluu): Do we want separate counts for the other |
| 225 // (platform-specific) process types? |
221 | 226 |
222 int total_sample = static_cast<int>(aggregate_memory / 1000); | 227 int total_sample = static_cast<int>(aggregate_memory / 1000); |
223 UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample); | 228 UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample); |
224 } | 229 } |
OLD | NEW |