OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_version_info.h" | 7 #include "base/file_version_info.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 RenderProcessHost::AllHostsIterator()); !renderer_iter.IsAtEnd(); | 128 RenderProcessHost::AllHostsIterator()); !renderer_iter.IsAtEnd(); |
129 renderer_iter.Advance()) { | 129 renderer_iter.Advance()) { |
130 RenderProcessHost* render_process_host = renderer_iter.GetCurrentValue(); | 130 RenderProcessHost* render_process_host = renderer_iter.GetCurrentValue(); |
131 DCHECK(render_process_host); | 131 DCHECK(render_process_host); |
132 // Ignore processes that don't have a connection, such as crashed tabs. | 132 // Ignore processes that don't have a connection, such as crashed tabs. |
133 if (!render_process_host->HasConnection() || | 133 if (!render_process_host->HasConnection() || |
134 process.pid != base::GetProcId(render_process_host->GetHandle())) { | 134 process.pid != base::GetProcId(render_process_host->GetHandle())) { |
135 continue; | 135 continue; |
136 } | 136 } |
137 process.type = ChildProcessInfo::RENDER_PROCESS; | 137 process.type = ChildProcessInfo::RENDER_PROCESS; |
138 Profile* profile = | 138 Profile* profile = render_process_host->profile(); |
139 Profile::FromBrowserContext(render_process_host->browser_context()); | |
140 ExtensionService* extension_service = profile->GetExtensionService(); | 139 ExtensionService* extension_service = profile->GetExtensionService(); |
141 | 140 |
142 // The RenderProcessHost may host multiple TabContents. Any | 141 // The RenderProcessHost may host multiple TabContents. Any |
143 // of them which contain diagnostics information make the whole | 142 // of them which contain diagnostics information make the whole |
144 // process be considered a diagnostics process. | 143 // process be considered a diagnostics process. |
145 // | 144 // |
146 // NOTE: This is a bit dangerous. We know that for now, listeners | 145 // NOTE: This is a bit dangerous. We know that for now, listeners |
147 // are always RenderWidgetHosts. But in theory, they don't | 146 // are always RenderWidgetHosts. But in theory, they don't |
148 // have to be. | 147 // have to be. |
149 RenderProcessHost::listeners_iterator iter( | 148 RenderProcessHost::listeners_iterator iter( |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 UMA_HISTOGRAM_COUNTS_100("Memory.OtherProcessCount", other_count); | 349 UMA_HISTOGRAM_COUNTS_100("Memory.OtherProcessCount", other_count); |
351 UMA_HISTOGRAM_COUNTS_100("Memory.PluginProcessCount", plugin_count); | 350 UMA_HISTOGRAM_COUNTS_100("Memory.PluginProcessCount", plugin_count); |
352 UMA_HISTOGRAM_COUNTS_100("Memory.RendererProcessCount", renderer_count); | 351 UMA_HISTOGRAM_COUNTS_100("Memory.RendererProcessCount", renderer_count); |
353 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count); | 352 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count); |
354 // TODO(viettrungluu): Do we want separate counts for the other | 353 // TODO(viettrungluu): Do we want separate counts for the other |
355 // (platform-specific) process types? | 354 // (platform-specific) process types? |
356 | 355 |
357 int total_sample = static_cast<int>(aggregate_memory / 1000); | 356 int total_sample = static_cast<int>(aggregate_memory / 1000); |
358 UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample); | 357 UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample); |
359 } | 358 } |
OLD | NEW |