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

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

Issue 2875823004: Add experimental private memory footprint metrics. (Closed)
Patch Set: compile error. 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/metrics_memory_details.h" 5 #include "chrome/browser/metrics/metrics_memory_details.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 switch (browser.processes[index].process_type) { 101 switch (browser.processes[index].process_type) {
102 case content::PROCESS_TYPE_BROWSER: 102 case content::PROCESS_TYPE_BROWSER:
103 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Browser.Large2", sample / 1024); 103 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Browser.Large2", sample / 1024);
104 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Browser.Committed", 104 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Browser.Committed",
105 committed / 1024); 105 committed / 1024);
106 if (num_open_fds != -1 && open_fds_soft_limit != -1) { 106 if (num_open_fds != -1 && open_fds_soft_limit != -1) {
107 UMA_HISTOGRAM_COUNTS_10000("Memory.Browser.OpenFDs", num_open_fds); 107 UMA_HISTOGRAM_COUNTS_10000("Memory.Browser.OpenFDs", num_open_fds);
108 UMA_HISTOGRAM_COUNTS_10000("Memory.Browser.OpenFDsSoftLimit", 108 UMA_HISTOGRAM_COUNTS_10000("Memory.Browser.OpenFDsSoftLimit",
109 open_fds_soft_limit); 109 open_fds_soft_limit);
110 } 110 }
111 #if defined(OS_MACOSX)
112 UMA_HISTOGRAM_MEMORY_LARGE_MB(
113 "Memory.Experimental.Browser.PrivateMemoryFootprint.MacOS",
114 browser.processes[index].private_memory_footprint / 1024 / 1024);
115 #endif
111 continue; 116 continue;
112 case content::PROCESS_TYPE_RENDERER: { 117 case content::PROCESS_TYPE_RENDERER: {
113 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.RendererAll", sample / 1024); 118 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.RendererAll", sample / 1024);
114 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.RendererAll.Committed", 119 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.RendererAll.Committed",
115 committed / 1024); 120 committed / 1024);
116 if (num_open_fds != -1 && open_fds_soft_limit != -1) { 121 if (num_open_fds != -1 && open_fds_soft_limit != -1) {
117 UMA_HISTOGRAM_COUNTS_10000("Memory.RendererAll.OpenFDs", 122 UMA_HISTOGRAM_COUNTS_10000("Memory.RendererAll.OpenFDs",
118 num_open_fds); 123 num_open_fds);
119 UMA_HISTOGRAM_COUNTS_10000("Memory.RendererAll.OpenFDsSoftLimit", 124 UMA_HISTOGRAM_COUNTS_10000("Memory.RendererAll.OpenFDsSoftLimit",
120 open_fds_soft_limit); 125 open_fds_soft_limit);
121 } 126 }
122 ProcessMemoryInformation::RendererProcessType renderer_type = 127 ProcessMemoryInformation::RendererProcessType renderer_type =
123 browser.processes[index].renderer_type; 128 browser.processes[index].renderer_type;
124 switch (renderer_type) { 129 switch (renderer_type) {
125 case ProcessMemoryInformation::RENDERER_EXTENSION: 130 case ProcessMemoryInformation::RENDERER_EXTENSION:
126 UMA_HISTOGRAM_MEMORY_KB("Memory.Extension", sample); 131 UMA_HISTOGRAM_MEMORY_KB("Memory.Extension", sample);
127 if (num_open_fds != -1) { 132 if (num_open_fds != -1) {
128 UMA_HISTOGRAM_COUNTS_10000("Memory.Extension.OpenFDs", 133 UMA_HISTOGRAM_COUNTS_10000("Memory.Extension.OpenFDs",
129 num_open_fds); 134 num_open_fds);
130 } 135 }
131 extension_count++; 136 extension_count++;
137 #if defined(OS_MACOSX)
138 UMA_HISTOGRAM_MEMORY_LARGE_MB(
139 "Memory.Experimental.Extension.PrivateMemoryFootprint.MacOS",
140 browser.processes[index].private_memory_footprint / 1024 /
141 1024);
142 #endif
132 continue; 143 continue;
133 case ProcessMemoryInformation::RENDERER_CHROME: 144 case ProcessMemoryInformation::RENDERER_CHROME:
134 UMA_HISTOGRAM_MEMORY_KB("Memory.Chrome", sample); 145 UMA_HISTOGRAM_MEMORY_KB("Memory.Chrome", sample);
135 if (num_open_fds != -1) 146 if (num_open_fds != -1)
136 UMA_HISTOGRAM_COUNTS_10000("Memory.Chrome.OpenFDs", num_open_fds); 147 UMA_HISTOGRAM_COUNTS_10000("Memory.Chrome.OpenFDs", num_open_fds);
137 chrome_count++; 148 chrome_count++;
138 continue; 149 continue;
139 case ProcessMemoryInformation::RENDERER_UNKNOWN: 150 case ProcessMemoryInformation::RENDERER_UNKNOWN:
140 NOTREACHED() << "Unknown renderer process type."; 151 NOTREACHED() << "Unknown renderer process type.";
141 continue; 152 continue;
142 case ProcessMemoryInformation::RENDERER_NORMAL: 153 case ProcessMemoryInformation::RENDERER_NORMAL:
143 default: 154 default:
155 #if defined(OS_MACOSX)
156 UMA_HISTOGRAM_MEMORY_LARGE_MB(
157 "Memory.Experimental.Renderer.PrivateMemoryFootprint.MacOS",
158 browser.processes[index].private_memory_footprint / 1024 /
159 1024);
160 #endif
144 // TODO(erikkay): Should we bother splitting out the other subtypes? 161 // TODO(erikkay): Should we bother splitting out the other subtypes?
145 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Renderer.Large2", 162 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Renderer.Large2",
146 sample / 1024); 163 sample / 1024);
147 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Renderer.Committed", 164 UMA_HISTOGRAM_MEMORY_LARGE_MB("Memory.Renderer.Committed",
148 committed / 1024); 165 committed / 1024);
149 if (num_open_fds != -1) { 166 if (num_open_fds != -1) {
150 UMA_HISTOGRAM_COUNTS_10000("Memory.Renderer.OpenFDs", 167 UMA_HISTOGRAM_COUNTS_10000("Memory.Renderer.OpenFDs",
151 num_open_fds); 168 num_open_fds);
152 } 169 }
153 renderer_count++; 170 renderer_count++;
(...skipping 21 matching lines...) Expand all
175 other_count++; 192 other_count++;
176 continue; 193 continue;
177 case content::PROCESS_TYPE_GPU: 194 case content::PROCESS_TYPE_GPU:
178 #if defined(OS_MACOSX) 195 #if defined(OS_MACOSX)
179 // Physical footprint was introduced in macOS 10.12. 196 // Physical footprint was introduced in macOS 10.12.
180 if (base::mac::IsAtLeastOS10_12()) { 197 if (base::mac::IsAtLeastOS10_12()) {
181 UMA_HISTOGRAM_MEMORY_LARGE_MB( 198 UMA_HISTOGRAM_MEMORY_LARGE_MB(
182 "Memory.Experimental.Gpu.PhysicalFootprint.MacOS", 199 "Memory.Experimental.Gpu.PhysicalFootprint.MacOS",
183 browser.processes[index].phys_footprint / 1024 / 1024); 200 browser.processes[index].phys_footprint / 1024 / 1024);
184 } 201 }
202 UMA_HISTOGRAM_MEMORY_LARGE_MB(
203 "Memory.Experimental.Gpu.PrivateMemoryFootprint.MacOS",
204 browser.processes[index].private_memory_footprint / 1024 / 1024);
185 #endif 205 #endif
186 UMA_HISTOGRAM_MEMORY_KB("Memory.Gpu", sample); 206 UMA_HISTOGRAM_MEMORY_KB("Memory.Gpu", sample);
187 if (num_open_fds != -1 && open_fds_soft_limit != -1) { 207 if (num_open_fds != -1 && open_fds_soft_limit != -1) {
188 UMA_HISTOGRAM_COUNTS_10000("Memory.Gpu.OpenFDs", num_open_fds); 208 UMA_HISTOGRAM_COUNTS_10000("Memory.Gpu.OpenFDs", num_open_fds);
189 UMA_HISTOGRAM_COUNTS_10000("Memory.Gpu.OpenFDsSoftLimit", 209 UMA_HISTOGRAM_COUNTS_10000("Memory.Gpu.OpenFDsSoftLimit",
190 open_fds_soft_limit); 210 open_fds_soft_limit);
191 } 211 }
192 other_count++; 212 other_count++;
193 continue; 213 continue;
194 #if BUILDFLAG(ENABLE_PLUGINS) 214 #if BUILDFLAG(ENABLE_PLUGINS)
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 memory_growth_tracker_->UpdateSample(process_entry.pid, sample, 401 memory_growth_tracker_->UpdateSample(process_entry.pid, sample,
382 &diff) && 402 &diff) &&
383 generate_histograms_) { 403 generate_histograms_) {
384 if (diff < 0) 404 if (diff < 0)
385 UMA_HISTOGRAM_MEMORY_KB("Memory.RendererShrinkIn30Min", -diff); 405 UMA_HISTOGRAM_MEMORY_KB("Memory.RendererShrinkIn30Min", -diff);
386 else 406 else
387 UMA_HISTOGRAM_MEMORY_KB("Memory.RendererGrowthIn30Min", diff); 407 UMA_HISTOGRAM_MEMORY_KB("Memory.RendererGrowthIn30Min", diff);
388 } 408 }
389 } 409 }
390 } 410 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698