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

Side by Side Diff: tracing/tracing/metrics/system_health/memory_metric.html

Issue 2998243002: Add sample Breakdowns to memoryMetric. (Closed)
Patch Set: . Created 3 years, 3 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright 2016 The Chromium Authors. All rights reserved. 3 Copyright 2016 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be 4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file. 5 found in the LICENSE file.
6 --> 6 -->
7 7
8 <link rel="import" href="/tracing/base/math/range.html"> 8 <link rel="import" href="/tracing/base/math/range.html">
9 <link rel="import" href="/tracing/base/multi_dimensional_view.html"> 9 <link rel="import" href="/tracing/base/multi_dimensional_view.html">
10 <link rel="import" href="/tracing/base/unit.html"> 10 <link rel="import" href="/tracing/base/unit.html">
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 browserName, sourceName, property.name, processName, componentPath); 1191 browserName, sourceName, property.name, processName, componentPath);
1192 const description = getNumericDescription( 1192 const description = getNumericDescription(
1193 property, browserName, processName, componentPath); 1193 property, browserName, processName, componentPath);
1194 1194
1195 // Build the underlying numeric for the memory value. 1195 // Build the underlying numeric for the memory value.
1196 const numeric = buildMemoryNumericFromNode(name, node, property.unit); 1196 const numeric = buildMemoryNumericFromNode(name, node, property.unit);
1197 numeric.description = description; 1197 numeric.description = description;
1198 return numeric; 1198 return numeric;
1199 } 1199 }
1200 1200
1201 function buildSampleDiagnostics(value, node) {
1202 const diagnostics = new Map();
1203 const processes = new tr.v.d.Breakdown();
1204 const components = new tr.v.d.Breakdown();
1205 console.log(value, node);
1206 if (processes.size > 0) diagnostics.set('processes', processes);
1207 if (components.size > 0) diagnostics.set('components', components);
1208 if (diagnostics.size === 0) return undefined;
1209 return diagnostics;
1210 }
1211
1201 /** 1212 /**
1202 * Create a memory tr.v.Histogram with |unit| and add all total values in 1213 * Create a memory tr.v.Histogram with |unit| and add all total values in
1203 * |node| to it. 1214 * |node| to it.
1204 */ 1215 */
1205 function buildMemoryNumericFromNode(name, node, unit) { 1216 function buildMemoryNumericFromNode(name, node, unit) {
1206 const histogram = new tr.v.Histogram( 1217 const histogram = new tr.v.Histogram(
1207 name, unit, BOUNDARIES_FOR_UNIT_MAP.get(unit)); 1218 name, unit, BOUNDARIES_FOR_UNIT_MAP.get(unit));
1208 node.values.forEach(v => histogram.addSample(v.total)); 1219
1220 node.values.forEach(v => histogram.addSample(
1221 v.total, buildSampleDiagnostics(v, node)));
1222
1209 return histogram; 1223 return histogram;
1210 } 1224 }
1211 1225
1212 tr.metrics.MetricRegistry.register(memoryMetric, { 1226 tr.metrics.MetricRegistry.register(memoryMetric, {
1213 supportsRangeOfInterest: true 1227 supportsRangeOfInterest: true
1214 }); 1228 });
1215 1229
1216 return { 1230 return {
1217 memoryMetric, 1231 memoryMetric,
1218 }; 1232 };
1219 }); 1233 });
1220 </script> 1234 </script>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698