| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include <psapi.h> | 6 #include <psapi.h> |
| 7 | 7 |
| 8 #include "base/file_version_info.h" | 8 #include "base/file_version_info.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 void MemoryDetails::CollectChildInfoOnIOThread() { | 64 void MemoryDetails::CollectChildInfoOnIOThread() { |
| 65 DCHECK(MessageLoop::current() == | 65 DCHECK(MessageLoop::current() == |
| 66 ChromeThread::GetMessageLoop(ChromeThread::IO)); | 66 ChromeThread::GetMessageLoop(ChromeThread::IO)); |
| 67 | 67 |
| 68 std::vector<ProcessMemoryInformation> child_info; | 68 std::vector<ProcessMemoryInformation> child_info; |
| 69 | 69 |
| 70 // Collect the list of child processes. | 70 // Collect the list of child processes. |
| 71 for (ChildProcessHost::Iterator iter; !iter.Done(); ++iter) { | 71 for (ChildProcessHost::Iterator iter; !iter.Done(); ++iter) { |
| 72 ProcessMemoryInformation info; | 72 ProcessMemoryInformation info; |
| 73 info.pid = iter->pid(); | 73 info.pid = iter->GetProcessId(); |
| 74 if (!info.pid) | 74 if (!info.pid) |
| 75 continue; | 75 continue; |
| 76 | 76 |
| 77 info.type = iter->type(); | 77 info.type = iter->type(); |
| 78 info.titles.push_back(iter->name()); | 78 info.titles.push_back(iter->name()); |
| 79 child_info.push_back(info); | 79 child_info.push_back(info); |
| 80 } | 80 } |
| 81 | 81 |
| 82 // Now go do expensive memory lookups from the file thread. | 82 // Now go do expensive memory lookups from the file thread. |
| 83 ChromeThread::GetMessageLoop(ChromeThread::FILE)->PostTask(FROM_HERE, | 83 ChromeThread::GetMessageLoop(ChromeThread::FILE)->PostTask(FROM_HERE, |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 } | 291 } |
| 292 | 292 |
| 293 UMA_HISTOGRAM_COUNTS_100("Memory.ProcessCount", | 293 UMA_HISTOGRAM_COUNTS_100("Memory.ProcessCount", |
| 294 static_cast<int>(browser.processes.size())); | 294 static_cast<int>(browser.processes.size())); |
| 295 UMA_HISTOGRAM_COUNTS_100("Memory.PluginProcessCount", plugin_count); | 295 UMA_HISTOGRAM_COUNTS_100("Memory.PluginProcessCount", plugin_count); |
| 296 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count); | 296 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count); |
| 297 | 297 |
| 298 int total_sample = static_cast<int>(aggregate_memory / 1000); | 298 int total_sample = static_cast<int>(aggregate_memory / 1000); |
| 299 UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample); | 299 UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample); |
| 300 } | 300 } |
| OLD | NEW |