OLD | NEW |
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 | |
24 // TODO(erikchen): Emit private memory footprint. https://crbug.com/721434. | 23 // TODO(erikchen): Emit private memory footprint. https://crbug.com/721434. |
25 } | 24 } |
26 | 25 |
27 void EmitRendererMemoryMetrics(const ProcessMemoryDumpPtr& pmd) { | 26 void EmitRendererMemoryMetrics(const ProcessMemoryDumpPtr& pmd) { |
28 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Renderer2.Resident", | 27 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Renderer2.Resident", |
29 pmd->os_dump.resident_set_kb * 1024); | 28 pmd->os_dump.resident_set_kb / 1024); |
30 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Renderer2.Malloc", | 29 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Renderer2.Malloc", |
31 pmd->chrome_dump.malloc_total_kb * 1024); | 30 pmd->chrome_dump.malloc_total_kb / 1024); |
32 UMA_HISTOGRAM_MEMORY_LARGE_MB( | 31 UMA_HISTOGRAM_MEMORY_LARGE_MB( |
33 "Memory.Experimental.Renderer2.PartitionAlloc", | 32 "Memory.Experimental.Renderer2.PartitionAlloc", |
34 pmd->chrome_dump.partition_alloc_total_kb * 1024); | 33 pmd->chrome_dump.partition_alloc_total_kb / 1024); |
35 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Renderer2.BlinkGC", | 34 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Renderer2.BlinkGC", |
36 pmd->chrome_dump.blink_gc_total_kb * 1024); | 35 pmd->chrome_dump.blink_gc_total_kb / 1024); |
37 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Renderer2.V8", | 36 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Renderer2.V8", |
38 pmd->chrome_dump.v8_total_kb * 1024); | 37 pmd->chrome_dump.v8_total_kb / 1024); |
39 | 38 |
40 // TODO(erikchen): Emit private memory footprint. https://crbug.com/721434. | 39 // TODO(erikchen): Emit private memory footprint. https://crbug.com/721434. |
41 } | 40 } |
42 | 41 |
43 void EmitGpuMemoryMetrics(const ProcessMemoryDumpPtr& pmd) { | 42 void EmitGpuMemoryMetrics(const ProcessMemoryDumpPtr& pmd) { |
44 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Gpu2.Resident", | 43 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Gpu2.Resident", |
45 pmd->os_dump.resident_set_kb * 1024); | 44 pmd->os_dump.resident_set_kb / 1024); |
46 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Gpu2.Malloc", | 45 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Experimental.Gpu2.Malloc", |
47 pmd->chrome_dump.malloc_total_kb * 1024); | 46 pmd->chrome_dump.malloc_total_kb / 1024); |
48 | 47 |
49 // TODO(erikchen): Emit private memory footprint. https://crbug.com/721434. | 48 // TODO(erikchen): Emit private memory footprint. https://crbug.com/721434. |
50 } | 49 } |
51 | 50 |
52 } // namespace | 51 } // namespace |
53 | 52 |
54 ProcessMemoryMetricsEmitter::ProcessMemoryMetricsEmitter() {} | 53 ProcessMemoryMetricsEmitter::ProcessMemoryMetricsEmitter() {} |
55 | 54 |
56 void ProcessMemoryMetricsEmitter::FetchAndEmitProcessMemoryMetrics() { | 55 void ProcessMemoryMetricsEmitter::FetchAndEmitProcessMemoryMetrics() { |
57 service_manager::Connector* connector = | 56 service_manager::Connector* connector = |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 case memory_instrumentation::mojom::ProcessType::GPU: | 90 case memory_instrumentation::mojom::ProcessType::GPU: |
92 EmitGpuMemoryMetrics(pmd); | 91 EmitGpuMemoryMetrics(pmd); |
93 break; | 92 break; |
94 case memory_instrumentation::mojom::ProcessType::UTILITY: | 93 case memory_instrumentation::mojom::ProcessType::UTILITY: |
95 case memory_instrumentation::mojom::ProcessType::PLUGIN: | 94 case memory_instrumentation::mojom::ProcessType::PLUGIN: |
96 case memory_instrumentation::mojom::ProcessType::OTHER: | 95 case memory_instrumentation::mojom::ProcessType::OTHER: |
97 break; | 96 break; |
98 } | 97 } |
99 } | 98 } |
100 } | 99 } |
OLD | NEW |