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

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

Issue 2283213002: Rename Histogram.add() to addSample(). (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: rebase Created 4 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
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 11 matching lines...) Expand all
22 22
23 var BYTE_BOUNDARIES = tr.v.HistogramBinBoundaries.createExponential( 23 var BYTE_BOUNDARIES = tr.v.HistogramBinBoundaries.createExponential(
24 1, 1e9, 30); 24 1, 1e9, 30);
25 25
26 var COUNT_BOUNDARIES = tr.v.HistogramBinBoundaries.createExponential( 26 var COUNT_BOUNDARIES = tr.v.HistogramBinBoundaries.createExponential(
27 1, 1e5, 30); 27 1, 1e5, 30);
28 28
29 function addTimeDurationValue(valueName, duration, allValues) { 29 function addTimeDurationValue(valueName, duration, allValues) {
30 var hist = new tr.v.Histogram( 30 var hist = new tr.v.Histogram(
31 tr.v.Unit.byName.timeDurationInMs_smallerIsBetter, TIME_BOUNDARIES); 31 tr.v.Unit.byName.timeDurationInMs_smallerIsBetter, TIME_BOUNDARIES);
32 hist.add(duration); 32 hist.addSample(duration);
33 allValues.addValue(new tr.v.NumericValue(valueName, hist)); 33 allValues.addValue(new tr.v.NumericValue(valueName, hist));
34 } 34 }
35 35
36 // Adds values specific to memory-infra dumps. 36 // Adds values specific to memory-infra dumps.
37 function addMemoryInfraValues(values, model, categoryNamesToTotalEventSizes) { 37 function addMemoryInfraValues(values, model, categoryNamesToTotalEventSizes) {
38 var memoryDumpCount = model.globalMemoryDumps.length; 38 var memoryDumpCount = model.globalMemoryDumps.length;
39 if (memoryDumpCount === 0) 39 if (memoryDumpCount === 0)
40 return; 40 return;
41 41
42 var totalOverhead = 0; 42 var totalOverhead = 0;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 tr.b.iterItems(overheadByProvider, function(providerName, overhead) { 74 tr.b.iterItems(overheadByProvider, function(providerName, overhead) {
75 addTimeDurationValue( 75 addTimeDurationValue(
76 'Average CPU overhead of ' + providerName + ' per OnMemoryDump call', 76 'Average CPU overhead of ' + providerName + ' per OnMemoryDump call',
77 overhead.duration / overhead.count, values); 77 overhead.duration / overhead.count, values);
78 }); 78 });
79 79
80 var memoryInfraEventsSize = 80 var memoryInfraEventsSize =
81 categoryNamesToTotalEventSizes.get(MEMORY_INFRA_TRACING_CATEGORY); 81 categoryNamesToTotalEventSizes.get(MEMORY_INFRA_TRACING_CATEGORY);
82 var memoryInfraTraceBytesValue = new tr.v.Histogram( 82 var memoryInfraTraceBytesValue = new tr.v.Histogram(
83 tr.v.Unit.byName.sizeInBytes_smallerIsBetter, BYTE_BOUNDARIES); 83 tr.v.Unit.byName.sizeInBytes_smallerIsBetter, BYTE_BOUNDARIES);
84 memoryInfraTraceBytesValue.add(memoryInfraEventsSize); 84 memoryInfraTraceBytesValue.addSample(memoryInfraEventsSize);
85 values.addValue(new tr.v.NumericValue( 85 values.addValue(new tr.v.NumericValue(
86 'Total trace size of memory-infra dumps in bytes', 86 'Total trace size of memory-infra dumps in bytes',
87 memoryInfraTraceBytesValue)); 87 memoryInfraTraceBytesValue));
88 88
89 var traceBytesPerDumpValue = new tr.v.Histogram( 89 var traceBytesPerDumpValue = new tr.v.Histogram(
90 tr.v.Unit.byName.sizeInBytes_smallerIsBetter, BYTE_BOUNDARIES); 90 tr.v.Unit.byName.sizeInBytes_smallerIsBetter, BYTE_BOUNDARIES);
91 traceBytesPerDumpValue.add(memoryInfraEventsSize / memoryDumpCount); 91 traceBytesPerDumpValue.addSample(memoryInfraEventsSize / memoryDumpCount);
92 values.addValue(new tr.v.NumericValue( 92 values.addValue(new tr.v.NumericValue(
93 'Average trace size of memory-infra dumps in bytes', 93 'Average trace size of memory-infra dumps in bytes',
94 traceBytesPerDumpValue)); 94 traceBytesPerDumpValue));
95 } 95 }
96 96
97 function tracingMetric(values, model) { 97 function tracingMetric(values, model) {
98 if (!model.stats.hasEventSizesinBytes) { 98 if (!model.stats.hasEventSizesinBytes) {
99 throw new Error('Model stats does not have event size information. ' + 99 throw new Error('Model stats does not have event size information. ' +
100 'Please enable ImportOptions.trackDetailedModelStats.'); 100 'Please enable ImportOptions.trackDetailedModelStats.');
101 } 101 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 156
157 // Determine the category with the highest total event size. 157 // Determine the category with the highest total event size.
158 var maxCatNameAndBytes = Array.from( 158 var maxCatNameAndBytes = Array.from(
159 categoryNamesToTotalEventSizes.entries()).reduce( 159 categoryNamesToTotalEventSizes.entries()).reduce(
160 (a, b) => (b[1] >= a[1]) ? b : a); 160 (a, b) => (b[1] >= a[1]) ? b : a);
161 var maxEventBytesPerCategory = maxCatNameAndBytes[1]; 161 var maxEventBytesPerCategory = maxCatNameAndBytes[1];
162 var categoryWithMaxEventBytes = maxCatNameAndBytes[0]; 162 var categoryWithMaxEventBytes = maxCatNameAndBytes[0];
163 163
164 var maxEventCountPerSecValue = new tr.v.Histogram( 164 var maxEventCountPerSecValue = new tr.v.Histogram(
165 tr.v.Unit.byName.count_smallerIsBetter, COUNT_BOUNDARIES); 165 tr.v.Unit.byName.count_smallerIsBetter, COUNT_BOUNDARIES);
166 maxEventCountPerSecValue.add(maxEventCountPerSec); 166 maxEventCountPerSecValue.addSample(maxEventCountPerSec);
167 167
168 var maxEventBytesPerSecValue = new tr.v.Histogram( 168 var maxEventBytesPerSecValue = new tr.v.Histogram(
169 tr.v.Unit.byName.sizeInBytes_smallerIsBetter, BYTE_BOUNDARIES); 169 tr.v.Unit.byName.sizeInBytes_smallerIsBetter, BYTE_BOUNDARIES);
170 maxEventBytesPerSecValue.add(maxEventBytesPerSec); 170 maxEventBytesPerSecValue.addSample(maxEventBytesPerSec);
171 171
172 var totalTraceBytesValue = new tr.v.Histogram( 172 var totalTraceBytesValue = new tr.v.Histogram(
173 tr.v.Unit.byName.sizeInBytes_smallerIsBetter, BYTE_BOUNDARIES); 173 tr.v.Unit.byName.sizeInBytes_smallerIsBetter, BYTE_BOUNDARIES);
174 totalTraceBytesValue.add(totalTraceBytes); 174 totalTraceBytesValue.addSample(totalTraceBytes);
175 175
176 var biggestCategory = { 176 var biggestCategory = {
177 name: categoryWithMaxEventBytes, 177 name: categoryWithMaxEventBytes,
178 size_in_bytes: maxEventBytesPerCategory 178 size_in_bytes: maxEventBytesPerCategory
179 }; 179 };
180 180
181 var totalBytes = new tr.v.NumericValue( 181 var totalBytes = new tr.v.NumericValue(
182 'Total trace size in bytes', totalTraceBytesValue); 182 'Total trace size in bytes', totalTraceBytesValue);
183 totalBytes.diagnostics.set( 183 totalBytes.diagnostics.set(
184 'category_with_max_event_size', new tr.v.d.Generic(biggestCategory)); 184 'category_with_max_event_size', new tr.v.d.Generic(biggestCategory));
(...skipping 16 matching lines...) Expand all
201 201
202 tr.metrics.MetricRegistry.register(tracingMetric); 202 tr.metrics.MetricRegistry.register(tracingMetric);
203 203
204 return { 204 return {
205 tracingMetric: tracingMetric, 205 tracingMetric: tracingMetric,
206 // For testing only: 206 // For testing only:
207 MEMORY_INFRA_TRACING_CATEGORY: MEMORY_INFRA_TRACING_CATEGORY 207 MEMORY_INFRA_TRACING_CATEGORY: MEMORY_INFRA_TRACING_CATEGORY
208 }; 208 };
209 }); 209 });
210 </script> 210 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/metrics/system_health/webview_startup_metric.html ('k') | tracing/tracing/metrics/v8/execution_metric.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698