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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_version_info.h" | 8 #include "base/file_version_info.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "grit/chromium_strings.h" | 28 #include "grit/chromium_strings.h" |
29 #include "grit/generated_resources.h" | 29 #include "grit/generated_resources.h" |
30 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
31 | 31 |
32 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 32 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
33 #include "content/browser/renderer_host/render_sandbox_host_linux.h" | 33 #include "content/browser/renderer_host/render_sandbox_host_linux.h" |
34 #include "content/browser/zygote_host_linux.h" | 34 #include "content/browser/zygote_host_linux.h" |
35 #endif | 35 #endif |
36 | 36 |
37 using content::BrowserThread; | 37 using content::BrowserThread; |
| 38 using content::NavigationEntry; |
38 | 39 |
39 // static | 40 // static |
40 std::string ProcessMemoryInformation::GetRendererTypeNameInEnglish( | 41 std::string ProcessMemoryInformation::GetRendererTypeNameInEnglish( |
41 RendererProcessType type) { | 42 RendererProcessType type) { |
42 switch (type) { | 43 switch (type) { |
43 case RENDERER_NORMAL: | 44 case RENDERER_NORMAL: |
44 return "Tab"; | 45 return "Tab"; |
45 case RENDERER_CHROME: | 46 case RENDERER_CHROME: |
46 return "Tab (Chrome)"; | 47 return "Tab (Chrome)"; |
47 case RENDERER_EXTENSION: | 48 case RENDERER_EXTENSION: |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 // see if it's a chrome://memory URL (we don't want to count these in | 278 // see if it's a chrome://memory URL (we don't want to count these in |
278 // the total memory usage of the browser). | 279 // the total memory usage of the browser). |
279 // | 280 // |
280 // When we reach here, chrome://memory will be the pending entry since | 281 // When we reach here, chrome://memory will be the pending entry since |
281 // we haven't responded with any data such that it would be committed. | 282 // we haven't responded with any data such that it would be committed. |
282 // If you have another chrome://memory tab open (which would be | 283 // If you have another chrome://memory tab open (which would be |
283 // committed), we don't want to count it either, so we also check the | 284 // committed), we don't want to count it either, so we also check the |
284 // last committed entry. | 285 // last committed entry. |
285 // | 286 // |
286 // Either the pending or last committed entries can be NULL. | 287 // Either the pending or last committed entries can be NULL. |
287 const content::NavigationEntry* pending_entry = | 288 const NavigationEntry* pending_entry = |
288 contents->GetController().GetPendingEntry(); | 289 contents->GetController().GetPendingEntry(); |
289 const content::NavigationEntry* last_committed_entry = | 290 const NavigationEntry* last_committed_entry = |
290 contents->GetController().GetLastCommittedEntry(); | 291 contents->GetController().GetLastCommittedEntry(); |
291 if ((last_committed_entry && | 292 if ((last_committed_entry && |
292 LowerCaseEqualsASCII(last_committed_entry->GetVirtualURL().spec(), | 293 LowerCaseEqualsASCII(last_committed_entry->GetVirtualURL().spec(), |
293 chrome::kChromeUIMemoryURL)) || | 294 chrome::kChromeUIMemoryURL)) || |
294 (pending_entry && | 295 (pending_entry && |
295 LowerCaseEqualsASCII(pending_entry->GetVirtualURL().spec(), | 296 LowerCaseEqualsASCII(pending_entry->GetVirtualURL().spec(), |
296 chrome::kChromeUIMemoryURL))) | 297 chrome::kChromeUIMemoryURL))) |
297 process.is_diagnostics = true; | 298 process.is_diagnostics = true; |
298 } | 299 } |
299 } | 300 } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 UMA_HISTOGRAM_COUNTS_100("Memory.PepperPluginProcessCount", | 421 UMA_HISTOGRAM_COUNTS_100("Memory.PepperPluginProcessCount", |
421 pepper_plugin_count); | 422 pepper_plugin_count); |
422 UMA_HISTOGRAM_COUNTS_100("Memory.RendererProcessCount", renderer_count); | 423 UMA_HISTOGRAM_COUNTS_100("Memory.RendererProcessCount", renderer_count); |
423 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count); | 424 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count); |
424 // TODO(viettrungluu): Do we want separate counts for the other | 425 // TODO(viettrungluu): Do we want separate counts for the other |
425 // (platform-specific) process types? | 426 // (platform-specific) process types? |
426 | 427 |
427 int total_sample = static_cast<int>(aggregate_memory / 1000); | 428 int total_sample = static_cast<int>(aggregate_memory / 1000); |
428 UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample); | 429 UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample); |
429 } | 430 } |
OLD | NEW |