| 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/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // pages (e.g. "about:xxx" URLs). Iterate the RenderProcessHosts to find | 87 // pages (e.g. "about:xxx" URLs). Iterate the RenderProcessHosts to find |
| 88 // the tab contents. | 88 // the tab contents. |
| 89 ProcessMemoryInformation& process = | 89 ProcessMemoryInformation& process = |
| 90 chrome_browser->processes[index]; | 90 chrome_browser->processes[index]; |
| 91 | 91 |
| 92 for (RenderProcessHost::iterator renderer_iter( | 92 for (RenderProcessHost::iterator renderer_iter( |
| 93 RenderProcessHost::AllHostsIterator()); !renderer_iter.IsAtEnd(); | 93 RenderProcessHost::AllHostsIterator()); !renderer_iter.IsAtEnd(); |
| 94 renderer_iter.Advance()) { | 94 renderer_iter.Advance()) { |
| 95 DCHECK(renderer_iter.GetCurrentValue()); | 95 DCHECK(renderer_iter.GetCurrentValue()); |
| 96 // Ignore processes that don't have a connection, such as crashed tabs or | 96 // Ignore processes that don't have a connection, such as crashed tabs or |
| 97 // phantom tabs. | 97 // tabs that need to be reloaded. |
| 98 if (!renderer_iter.GetCurrentValue()->HasConnection() || process.pid != | 98 if (!renderer_iter.GetCurrentValue()->HasConnection() || process.pid != |
| 99 base::GetProcId(renderer_iter.GetCurrentValue()->GetHandle())) { | 99 base::GetProcId(renderer_iter.GetCurrentValue()->GetHandle())) { |
| 100 continue; | 100 continue; |
| 101 } | 101 } |
| 102 process.type = ChildProcessInfo::RENDER_PROCESS; | 102 process.type = ChildProcessInfo::RENDER_PROCESS; |
| 103 // The RenderProcessHost may host multiple TabContents. Any | 103 // The RenderProcessHost may host multiple TabContents. Any |
| 104 // of them which contain diagnostics information make the whole | 104 // of them which contain diagnostics information make the whole |
| 105 // process be considered a diagnostics process. | 105 // process be considered a diagnostics process. |
| 106 // | 106 // |
| 107 // NOTE: This is a bit dangerous. We know that for now, listeners | 107 // NOTE: This is a bit dangerous. We know that for now, listeners |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 UMA_HISTOGRAM_COUNTS_100("Memory.ProcessCount", | 228 UMA_HISTOGRAM_COUNTS_100("Memory.ProcessCount", |
| 229 static_cast<int>(browser.processes.size())); | 229 static_cast<int>(browser.processes.size())); |
| 230 UMA_HISTOGRAM_COUNTS_100("Memory.PluginProcessCount", plugin_count); | 230 UMA_HISTOGRAM_COUNTS_100("Memory.PluginProcessCount", plugin_count); |
| 231 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count); | 231 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count); |
| 232 // TODO(viettrungluu): Do we want separate counts for the other | 232 // TODO(viettrungluu): Do we want separate counts for the other |
| 233 // (platform-specific) process types? | 233 // (platform-specific) process types? |
| 234 | 234 |
| 235 int total_sample = static_cast<int>(aggregate_memory / 1000); | 235 int total_sample = static_cast<int>(aggregate_memory / 1000); |
| 236 UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample); | 236 UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample); |
| 237 } | 237 } |
| OLD | NEW |