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

Side by Side Diff: tracing/tracing/metrics/tracing_metric.html

Issue 2658143002: Create a trace import duration metric (Closed)
Patch Set: Created 3 years, 10 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 <!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/iteration_helpers.html"> 8 <link rel="import" href="/tracing/base/iteration_helpers.html">
9 <link rel="import" href="/tracing/metrics/metric_registry.html"> 9 <link rel="import" href="/tracing/metrics/metric_registry.html">
10 <link rel="import" href="/tracing/value/diagnostics/diagnostic_map.html"> 10 <link rel="import" href="/tracing/value/diagnostics/diagnostic_map.html">
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 memoryInfraTraceBytesValue.addSample(memoryInfraEventsSize); 85 memoryInfraTraceBytesValue.addSample(memoryInfraEventsSize);
86 histograms.addHistogram(memoryInfraTraceBytesValue); 86 histograms.addHistogram(memoryInfraTraceBytesValue);
87 87
88 var traceBytesPerDumpValue = new tr.v.Histogram( 88 var traceBytesPerDumpValue = new tr.v.Histogram(
89 'Average trace size of memory-infra dumps in bytes', 89 'Average trace size of memory-infra dumps in bytes',
90 tr.b.Unit.byName.sizeInBytes_smallerIsBetter, BYTE_BOUNDARIES); 90 tr.b.Unit.byName.sizeInBytes_smallerIsBetter, BYTE_BOUNDARIES);
91 traceBytesPerDumpValue.addSample(memoryInfraEventsSize / memoryDumpCount); 91 traceBytesPerDumpValue.addSample(memoryInfraEventsSize / memoryDumpCount);
92 histograms.addHistogram(traceBytesPerDumpValue); 92 histograms.addHistogram(traceBytesPerDumpValue);
93 } 93 }
94 94
95 // TODO(charliea): The metrics in this file should be renamed to have names
96 // more consistent with those in the rest of the codebase
97 // (e.g. 'trace_size_growth_rate' with a unit of bytes/second, not 'Max event
benjhayden 2017/02/17 16:48:55 This comment is fine as is, but I wanted to make a
charliea (OOO until 10-5) 2017/02/17 20:26:04 Hmmm, yea, you're completely right. I hadn't reall
98 // size in bytes per second').
99 // https://github.com/catapult-project/catapult/issues/3233
95 function tracingMetric(histograms, model) { 100 function tracingMetric(histograms, model) {
96 if (!model.stats.hasEventSizesinBytes) { 101 addTimeDurationHistogram(
charliea (OOO until 10-5) 2017/02/17 16:16:58 As described above, I erred on the side of consist
97 throw new Error('Model stats does not have event size information. ' + 102 'trace_import_duration', model.stats.traceImportDurationMs, histograms);
98 'Please enable ImportOptions.trackDetailedModelStats.'); 103
99 } 104 if (!model.stats.hasEventSizesinBytes) return;
charliea (OOO until 10-5) 2017/02/17 16:16:58 This brings the metric more in line with other met
100 105
101 var eventStats = model.stats.allTraceEventStatsInTimeIntervals; 106 var eventStats = model.stats.allTraceEventStatsInTimeIntervals;
102 eventStats.sort(function(a, b) { 107 eventStats.sort(function(a, b) {
103 return a.timeInterval - b.timeInterval; 108 return a.timeInterval - b.timeInterval;
104 }); 109 });
105 110
106 var totalTraceBytes = eventStats.reduce((a, b) => 111 var totalTraceBytes = eventStats.reduce((a, b) =>
107 (a + b.totalEventSizeinBytes), 0); 112 (a + b.totalEventSizeinBytes), 0);
108 113
109 // We maintain a sliding window of records [start ... end-1] where end 114 // We maintain a sliding window of records [start ... end-1] where end
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 200
196 tr.metrics.MetricRegistry.register(tracingMetric); 201 tr.metrics.MetricRegistry.register(tracingMetric);
197 202
198 return { 203 return {
199 tracingMetric, 204 tracingMetric,
200 // For testing only: 205 // For testing only:
201 MEMORY_INFRA_TRACING_CATEGORY, 206 MEMORY_INFRA_TRACING_CATEGORY,
202 }; 207 };
203 }); 208 });
204 </script> 209 </script>
OLDNEW
« no previous file with comments | « no previous file | tracing/tracing/metrics/tracing_metric_test.html » ('j') | tracing/tracing/metrics/tracing_metric_test.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698