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

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

Issue 2272203002: Migrate tracing_metric from ScalarNumeric to Histograms (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: Created 4 years, 4 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 | tracing/tracing/metrics/tracing_metric_test.html » ('j') | 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/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">
11 <link rel="import" href="/tracing/value/numeric.html"> 11 <link rel="import" href="/tracing/value/histogram.html">
12 <link rel="import" href="/tracing/value/value.html"> 12 <link rel="import" href="/tracing/value/value.html">
13 13
14 <script> 14 <script>
15 'use strict'; 15 'use strict';
16 16
17 tr.exportTo('tr.metrics', function() { 17 tr.exportTo('tr.metrics', function() {
18 var MEMORY_INFRA_TRACING_CATEGORY = 'disabled-by-default-memory-infra'; 18 var MEMORY_INFRA_TRACING_CATEGORY = 'disabled-by-default-memory-infra';
19 19
20 var TIME_NUMERIC_BUILDER = tr.v.NumericBuilder.createExponential(
21 tr.v.Unit.byName.timeDurationInMs_smallerIsBetter,
22 tr.b.Range.fromExplicitRange(1e-2, 1e5), 30);
Zhen Wang 2016/08/25 21:19:46 ssid, can you take a look to see if this setting i
ssid 2016/08/26 22:32:13 I think the lower could be 1e-3. IIUC, 1e-2 means
23
24 var BYTE_NUMERIC_BUILDER = tr.v.NumericBuilder.createExponential(
25 tr.v.Unit.byName.sizeInBytes_smallerIsBetter,
26 tr.b.Range.fromExplicitRange(1, 1e9), 30);
27
28 var COUNT_NUMERIC_BUILDER = tr.v.NumericBuilder.createLinear(
29 tr.v.Unit.byName.count_smallerIsBetter,
30 tr.b.Range.fromExplicitRange(0, 1000), 40);
Zhen Wang 2016/08/25 21:19:46 1000 is not enough, e.g, the following has close t
benjhayden 2016/08/26 04:53:41 Thanks!
Zhen Wang 2016/08/26 20:52:55 sgtm
31
20 function addTimeDurationValue(valueName, duration, allValues) { 32 function addTimeDurationValue(valueName, duration, allValues) {
21 var scalarNumericValue = new tr.v.ScalarNumeric( 33 var hist = TIME_NUMERIC_BUILDER.build();
22 tr.v.Unit.byName.timeDurationInMs_smallerIsBetter, duration); 34 hist.add(duration);
23 var numericValue = new tr.v.NumericValue(valueName, scalarNumericValue); 35 allValues.addValue(new tr.v.NumericValue(valueName, hist));
24 allValues.addValue(numericValue);
25 } 36 }
26 37
27 // Adds values specific to memory-infra dumps. 38 // Adds values specific to memory-infra dumps.
28 function addMemoryInfraValues(values, model, categoryNamesToTotalEventSizes) { 39 function addMemoryInfraValues(values, model, categoryNamesToTotalEventSizes) {
29 var memoryDumpCount = model.globalMemoryDumps.length; 40 var memoryDumpCount = model.globalMemoryDumps.length;
30 if (memoryDumpCount === 0) 41 if (memoryDumpCount === 0)
31 return; 42 return;
32 43
33 var totalOverhead = 0; 44 var totalOverhead = 0;
34 var nonMemoryInfraThreadOverhead = 0; 45 var nonMemoryInfraThreadOverhead = 0;
(...skipping 23 matching lines...) Expand all
58 'dump', 69 'dump',
59 nonMemoryInfraThreadOverhead / memoryDumpCount, values); 70 nonMemoryInfraThreadOverhead / memoryDumpCount, values);
60 tr.b.iterItems(overheadByProvider, function(providerName, overhead) { 71 tr.b.iterItems(overheadByProvider, function(providerName, overhead) {
61 addTimeDurationValue( 72 addTimeDurationValue(
62 'Average CPU overhead of ' + providerName + ' per memory-infra dump', 73 'Average CPU overhead of ' + providerName + ' per memory-infra dump',
63 overhead / memoryDumpCount, values); 74 overhead / memoryDumpCount, values);
64 }); 75 });
65 76
66 var memoryInfraEventsSize = 77 var memoryInfraEventsSize =
67 categoryNamesToTotalEventSizes.get(MEMORY_INFRA_TRACING_CATEGORY); 78 categoryNamesToTotalEventSizes.get(MEMORY_INFRA_TRACING_CATEGORY);
68 var memoryInfraTraceBytesValue = new tr.v.ScalarNumeric( 79 var memoryInfraTraceBytesValue = BYTE_NUMERIC_BUILDER.build();
69 tr.v.Unit.byName.sizeInBytes_smallerIsBetter, memoryInfraEventsSize); 80 memoryInfraTraceBytesValue.add(memoryInfraEventsSize);
70 values.addValue(new tr.v.NumericValue( 81 values.addValue(new tr.v.NumericValue(
71 'Total trace size of memory-infra dumps in bytes', 82 'Total trace size of memory-infra dumps in bytes',
72 memoryInfraTraceBytesValue)); 83 memoryInfraTraceBytesValue));
73 84
74 var traceBytesPerDumpValue = new tr.v.ScalarNumeric( 85 var traceBytesPerDumpValue = BYTE_NUMERIC_BUILDER.build();
75 tr.v.Unit.byName.sizeInBytes_smallerIsBetter, 86 traceBytesPerDumpValue.add(memoryInfraEventsSize / memoryDumpCount);
76 memoryInfraEventsSize / memoryDumpCount);
77 values.addValue(new tr.v.NumericValue( 87 values.addValue(new tr.v.NumericValue(
78 'Average trace size of memory-infra dumps in bytes', 88 'Average trace size of memory-infra dumps in bytes',
79 traceBytesPerDumpValue)); 89 traceBytesPerDumpValue));
80 } 90 }
81 91
82 function tracingMetric(values, model) { 92 function tracingMetric(values, model) {
83 if (!model.stats.hasEventSizesinBytes) { 93 if (!model.stats.hasEventSizesinBytes) {
84 throw new Error('Model stats does not have event size information. ' + 94 throw new Error('Model stats does not have event size information. ' +
85 'Please enable ImportOptions.trackDetailedModelStats.'); 95 'Please enable ImportOptions.trackDetailedModelStats.');
86 } 96 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 ((map.get(stat.category) || 0) + 149 ((map.get(stat.category) || 0) +
140 stat.totalEventSizeinBytes))), new Map())); 150 stat.totalEventSizeinBytes))), new Map()));
141 151
142 // Determine the category with the highest total event size. 152 // Determine the category with the highest total event size.
143 var maxCatNameAndBytes = Array.from( 153 var maxCatNameAndBytes = Array.from(
144 categoryNamesToTotalEventSizes.entries()).reduce( 154 categoryNamesToTotalEventSizes.entries()).reduce(
145 (a, b) => (b[1] >= a[1]) ? b : a); 155 (a, b) => (b[1] >= a[1]) ? b : a);
146 var maxEventBytesPerCategory = maxCatNameAndBytes[1]; 156 var maxEventBytesPerCategory = maxCatNameAndBytes[1];
147 var categoryWithMaxEventBytes = maxCatNameAndBytes[0]; 157 var categoryWithMaxEventBytes = maxCatNameAndBytes[0];
148 158
149 var maxEventCountPerSecValue = new tr.v.ScalarNumeric( 159 var maxEventCountPerSecValue = COUNT_NUMERIC_BUILDER.build();
150 tr.v.Unit.byName.unitlessNumber_smallerIsBetter, maxEventCountPerSec); 160 maxEventCountPerSecValue.add(maxEventCountPerSec);
151 var maxEventBytesPerSecValue = new tr.v.ScalarNumeric( 161
152 tr.v.Unit.byName.sizeInBytes_smallerIsBetter, maxEventBytesPerSec); 162 var maxEventBytesPerSecValue = BYTE_NUMERIC_BUILDER.build();
153 var totalTraceBytesValue = new tr.v.ScalarNumeric( 163 maxEventBytesPerSecValue.add(maxEventBytesPerSec);
154 tr.v.Unit.byName.sizeInBytes_smallerIsBetter, totalTraceBytes); 164
165 var totalTraceBytesValue = BYTE_NUMERIC_BUILDER.build();
166 totalTraceBytesValue.add(totalTraceBytes);
155 167
156 var biggestCategory = { 168 var biggestCategory = {
157 name: categoryWithMaxEventBytes, 169 name: categoryWithMaxEventBytes,
158 size_in_bytes: maxEventBytesPerCategory 170 size_in_bytes: maxEventBytesPerCategory
159 }; 171 };
160 172
161 var totalBytes = new tr.v.NumericValue( 173 var totalBytes = new tr.v.NumericValue(
162 'Total trace size in bytes', totalTraceBytesValue); 174 'Total trace size in bytes', totalTraceBytesValue);
163 totalBytes.diagnostics.add( 175 totalBytes.diagnostics.add(
164 'category_with_max_event_size', new tr.v.d.Generic(biggestCategory)); 176 'category_with_max_event_size', new tr.v.d.Generic(biggestCategory));
(...skipping 16 matching lines...) Expand all
181 193
182 tr.metrics.MetricRegistry.register(tracingMetric); 194 tr.metrics.MetricRegistry.register(tracingMetric);
183 195
184 return { 196 return {
185 tracingMetric: tracingMetric, 197 tracingMetric: tracingMetric,
186 // For testing only: 198 // For testing only:
187 MEMORY_INFRA_TRACING_CATEGORY: MEMORY_INFRA_TRACING_CATEGORY 199 MEMORY_INFRA_TRACING_CATEGORY: MEMORY_INFRA_TRACING_CATEGORY
188 }; 200 };
189 }); 201 });
190 </script> 202 </script>
OLDNEW
« no previous file with comments | « no previous file | tracing/tracing/metrics/tracing_metric_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698