Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: chrome/browser/metrics/process_memory_metrics_emitter.cc

Issue 2884143002: Revert "[Memory-UMA] Implement basic working prototype." (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/metrics/process_memory_metrics_emitter_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/metrics/process_memory_metrics_emitter.h" 5 #include "chrome/browser/metrics/process_memory_metrics_emitter.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "base/trace_event/memory_dump_request_args.h" 8 #include "base/trace_event/memory_dump_request_args.h"
9 #include "content/public/common/service_manager_connection.h" 9 #include "content/public/common/service_manager_connection.h"
10 #include "content/public/common/service_names.mojom.h" 10 #include "content/public/common/service_names.mojom.h"
11 #include "services/service_manager/public/cpp/connector.h" 11 #include "services/service_manager/public/cpp/connector.h"
12 12
13 using ProcessMemoryDumpPtr = 13 using ProcessMemoryDumpPtr =
14 memory_instrumentation::mojom::ProcessMemoryDumpPtr; 14 memory_instrumentation::mojom::ProcessMemoryDumpPtr;
15 15
16 namespace { 16 namespace {
17 17
18 void EmitBrowserMemoryMetrics(const ProcessMemoryDumpPtr& pmd) { 18 void EmitBrowserMemoryMetrics(const ProcessMemoryDumpPtr& pmd) {
19 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Browser2.Resident", 19 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Browser2.Resident",
20 pmd->os_dump.resident_set_kb / 1024); 20 pmd->os_dump.resident_set_kb * 1024);
21 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Browser2.Malloc", 21 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Browser2.Malloc",
22 pmd->chrome_dump.malloc_total_kb / 1024); 22 pmd->chrome_dump.malloc_total_kb * 1024);
23 UMA_HISTOGRAM_MEMORY_LARGE_MB( 23
24 "Memory.Experimental.Browser2.PrivateMemoryFootprint", 24 // TODO(erikchen): Emit private memory footprint. https://crbug.com/721434.
25 pmd->private_footprint / 1024);
26 } 25 }
27 26
28 void EmitRendererMemoryMetrics(const ProcessMemoryDumpPtr& pmd) { 27 void EmitRendererMemoryMetrics(const ProcessMemoryDumpPtr& pmd) {
29 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Renderer2.Resident", 28 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Renderer2.Resident",
30 pmd->os_dump.resident_set_kb / 1024); 29 pmd->os_dump.resident_set_kb * 1024);
31 UMA_HISTOGRAM_MEMORY_LARGE_MB(
32 "Memory.Experimental.Renderer2.PrivateMemoryFootprint",
33 pmd->private_footprint / 1024);
34 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Renderer2.Malloc", 30 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Renderer2.Malloc",
35 pmd->chrome_dump.malloc_total_kb / 1024); 31 pmd->chrome_dump.malloc_total_kb * 1024);
36 UMA_HISTOGRAM_MEMORY_LARGE_MB( 32 UMA_HISTOGRAM_MEMORY_LARGE_MB(
37 "Memory.Experimental.Renderer2.PartitionAlloc", 33 "Memory.Experimental.Renderer2.PartitionAlloc",
38 pmd->chrome_dump.partition_alloc_total_kb / 1024); 34 pmd->chrome_dump.partition_alloc_total_kb * 1024);
39 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Renderer2.BlinkGC", 35 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Renderer2.BlinkGC",
40 pmd->chrome_dump.blink_gc_total_kb / 1024); 36 pmd->chrome_dump.blink_gc_total_kb * 1024);
41 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Renderer2.V8", 37 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Renderer2.V8",
42 pmd->chrome_dump.v8_total_kb / 1024); 38 pmd->chrome_dump.v8_total_kb * 1024);
39
40 // TODO(erikchen): Emit private memory footprint. https://crbug.com/721434.
43 } 41 }
44 42
45 void EmitGpuMemoryMetrics(const ProcessMemoryDumpPtr& pmd) { 43 void EmitGpuMemoryMetrics(const ProcessMemoryDumpPtr& pmd) {
46 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Gpu2.Resident", 44 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Gpu2.Resident",
47 pmd->os_dump.resident_set_kb / 1024); 45 pmd->os_dump.resident_set_kb * 1024);
48 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Gpu2.Malloc", 46 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Gpu2.Malloc",
49 pmd->chrome_dump.malloc_total_kb / 1024); 47 pmd->chrome_dump.malloc_total_kb * 1024);
50 UMA_HISTOGRAM_MEMORY_LARGE_MB( 48
51 "Memory.Experimental.Gpu2.PrivateMemoryFootprint", 49 // TODO(erikchen): Emit private memory footprint. https://crbug.com/721434.
52 pmd->private_footprint / 1024);
53 } 50 }
54 51
55 } // namespace 52 } // namespace
56 53
57 ProcessMemoryMetricsEmitter::ProcessMemoryMetricsEmitter() {} 54 ProcessMemoryMetricsEmitter::ProcessMemoryMetricsEmitter() {}
58 55
59 void ProcessMemoryMetricsEmitter::FetchAndEmitProcessMemoryMetrics() { 56 void ProcessMemoryMetricsEmitter::FetchAndEmitProcessMemoryMetrics() {
60 service_manager::Connector* connector = 57 service_manager::Connector* connector =
61 content::ServiceManagerConnection::GetForProcess()->GetConnector(); 58 content::ServiceManagerConnection::GetForProcess()->GetConnector();
62 connector->BindInterface(content::mojom::kBrowserServiceName, 59 connector->BindInterface(content::mojom::kBrowserServiceName,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 case memory_instrumentation::mojom::ProcessType::GPU: 91 case memory_instrumentation::mojom::ProcessType::GPU:
95 EmitGpuMemoryMetrics(pmd); 92 EmitGpuMemoryMetrics(pmd);
96 break; 93 break;
97 case memory_instrumentation::mojom::ProcessType::UTILITY: 94 case memory_instrumentation::mojom::ProcessType::UTILITY:
98 case memory_instrumentation::mojom::ProcessType::PLUGIN: 95 case memory_instrumentation::mojom::ProcessType::PLUGIN:
99 case memory_instrumentation::mojom::ProcessType::OTHER: 96 case memory_instrumentation::mojom::ProcessType::OTHER:
100 break; 97 break;
101 } 98 }
102 } 99 }
103 } 100 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/metrics/process_memory_metrics_emitter_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698