| 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 "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chrome_thread.h" | 10 #include "chrome/browser/chrome_thread.h" |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 244 |
| 245 ProcessData browser = process_data_[CHROME_BROWSER]; | 245 ProcessData browser = process_data_[CHROME_BROWSER]; |
| 246 size_t aggregate_memory = 0; | 246 size_t aggregate_memory = 0; |
| 247 int plugin_count = 0; | 247 int plugin_count = 0; |
| 248 int worker_count = 0; | 248 int worker_count = 0; |
| 249 for (size_t index = 0; index < browser.processes.size(); index++) { | 249 for (size_t index = 0; index < browser.processes.size(); index++) { |
| 250 int sample = static_cast<int>(browser.processes[index].working_set.priv); | 250 int sample = static_cast<int>(browser.processes[index].working_set.priv); |
| 251 aggregate_memory += sample; | 251 aggregate_memory += sample; |
| 252 switch (browser.processes[index].type) { | 252 switch (browser.processes[index].type) { |
| 253 case ChildProcessInfo::BROWSER_PROCESS: | 253 case ChildProcessInfo::BROWSER_PROCESS: |
| 254 UMA_HISTOGRAM_MEMORY_KB(L"Memory.Browser", sample); | 254 UMA_HISTOGRAM_MEMORY_KB("Memory.Browser", sample); |
| 255 break; | 255 break; |
| 256 case ChildProcessInfo::RENDER_PROCESS: | 256 case ChildProcessInfo::RENDER_PROCESS: |
| 257 UMA_HISTOGRAM_MEMORY_KB(L"Memory.Renderer", sample); | 257 UMA_HISTOGRAM_MEMORY_KB("Memory.Renderer", sample); |
| 258 break; | 258 break; |
| 259 case ChildProcessInfo::PLUGIN_PROCESS: | 259 case ChildProcessInfo::PLUGIN_PROCESS: |
| 260 UMA_HISTOGRAM_MEMORY_KB(L"Memory.Plugin", sample); | 260 UMA_HISTOGRAM_MEMORY_KB("Memory.Plugin", sample); |
| 261 plugin_count++; | 261 plugin_count++; |
| 262 break; | 262 break; |
| 263 case ChildProcessInfo::WORKER_PROCESS: | 263 case ChildProcessInfo::WORKER_PROCESS: |
| 264 UMA_HISTOGRAM_MEMORY_KB(L"Memory.Worker", sample); | 264 UMA_HISTOGRAM_MEMORY_KB("Memory.Worker", sample); |
| 265 worker_count++; | 265 worker_count++; |
| 266 break; | 266 break; |
| 267 } | 267 } |
| 268 } | 268 } |
| 269 | 269 |
| 270 UMA_HISTOGRAM_COUNTS_100(L"Memory.ProcessCount", | 270 UMA_HISTOGRAM_COUNTS_100("Memory.ProcessCount", |
| 271 static_cast<int>(browser.processes.size())); | 271 static_cast<int>(browser.processes.size())); |
| 272 UMA_HISTOGRAM_COUNTS_100(L"Memory.PluginProcessCount", plugin_count); | 272 UMA_HISTOGRAM_COUNTS_100("Memory.PluginProcessCount", plugin_count); |
| 273 UMA_HISTOGRAM_COUNTS_100(L"Memory.WorkerProcessCount", worker_count); | 273 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count); |
| 274 | 274 |
| 275 int total_sample = static_cast<int>(aggregate_memory / 1000); | 275 int total_sample = static_cast<int>(aggregate_memory / 1000); |
| 276 UMA_HISTOGRAM_MEMORY_MB(L"Memory.Total", total_sample); | 276 UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample); |
| 277 } | 277 } |
| OLD | NEW |