| 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" |
| 11 #include "chrome/browser/child_process_host.h" | 11 #include "chrome/browser/browser_child_process_host.h" |
| 12 #include "chrome/browser/chrome_thread.h" | 12 #include "chrome/browser/chrome_thread.h" |
| 13 #include "chrome/browser/renderer_host/backing_store_manager.h" | 13 #include "chrome/browser/renderer_host/backing_store_manager.h" |
| 14 #include "chrome/browser/renderer_host/render_process_host.h" | 14 #include "chrome/browser/renderer_host/render_process_host.h" |
| 15 #include "chrome/browser/renderer_host/render_view_host.h" | 15 #include "chrome/browser/renderer_host/render_view_host.h" |
| 16 #include "chrome/browser/tab_contents/navigation_entry.h" | 16 #include "chrome/browser/tab_contents/navigation_entry.h" |
| 17 #include "chrome/browser/tab_contents/tab_contents.h" | 17 #include "chrome/browser/tab_contents/tab_contents.h" |
| 18 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
| 19 #include "grit/chromium_strings.h" | 19 #include "grit/chromium_strings.h" |
| 20 | 20 |
| 21 #if defined(OS_LINUX) | 21 #if defined(OS_LINUX) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 46 ChromeThread::IO, FROM_HERE, | 46 ChromeThread::IO, FROM_HERE, |
| 47 NewRunnableMethod(this, &MemoryDetails::CollectChildInfoOnIOThread)); | 47 NewRunnableMethod(this, &MemoryDetails::CollectChildInfoOnIOThread)); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void MemoryDetails::CollectChildInfoOnIOThread() { | 50 void MemoryDetails::CollectChildInfoOnIOThread() { |
| 51 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); | 51 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); |
| 52 | 52 |
| 53 std::vector<ProcessMemoryInformation> child_info; | 53 std::vector<ProcessMemoryInformation> child_info; |
| 54 | 54 |
| 55 // Collect the list of child processes. | 55 // Collect the list of child processes. |
| 56 for (ChildProcessHost::Iterator iter; !iter.Done(); ++iter) { | 56 for (BrowserChildProcessHost::Iterator iter; !iter.Done(); ++iter) { |
| 57 ProcessMemoryInformation info; | 57 ProcessMemoryInformation info; |
| 58 info.pid = base::GetProcId(iter->handle()); | 58 info.pid = base::GetProcId(iter->handle()); |
| 59 if (!info.pid) | 59 if (!info.pid) |
| 60 continue; | 60 continue; |
| 61 | 61 |
| 62 info.type = iter->type(); | 62 info.type = iter->type(); |
| 63 info.titles.push_back(iter->name()); | 63 info.titles.push_back(iter->name()); |
| 64 child_info.push_back(info); | 64 child_info.push_back(info); |
| 65 } | 65 } |
| 66 | 66 |
| (...skipping 161 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 |