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

Side by Side Diff: tracing/tracing/metrics/blink/gc_metric.html

Issue 2293533002: Refactor NumericBuilder to HistogramBinBoundaries. (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 <link rel="import" href="/tracing/base/range.html"> 7 <link rel="import" href="/tracing/base/range.html">
8 <link rel="import" href="/tracing/metrics/metric_registry.html"> 8 <link rel="import" href="/tracing/metrics/metric_registry.html">
9 <link rel="import" href="/tracing/metrics/v8/utils.html"> 9 <link rel="import" href="/tracing/metrics/v8/utils.html">
10 <link rel="import" href="/tracing/value/histogram.html"> 10 <link rel="import" href="/tracing/value/histogram.html">
(...skipping 26 matching lines...) Expand all
37 addTotalIdleTimesOfTopEvents(values, model); 37 addTotalIdleTimesOfTopEvents(values, model);
38 } 38 }
39 39
40 tr.metrics.MetricRegistry.register(blinkGcMetric); 40 tr.metrics.MetricRegistry.register(blinkGcMetric);
41 41
42 var timeDurationInMs_smallerIsBetter = 42 var timeDurationInMs_smallerIsBetter =
43 tr.v.Unit.byName.timeDurationInMs_smallerIsBetter; 43 tr.v.Unit.byName.timeDurationInMs_smallerIsBetter;
44 var percentage_biggerIsBetter = 44 var percentage_biggerIsBetter =
45 tr.v.Unit.byName.normalizedPercentage_biggerIsBetter; 45 tr.v.Unit.byName.normalizedPercentage_biggerIsBetter;
46 46
47 var numericBuilder = new tr.v.NumericBuilder(
48 timeDurationInMs_smallerIsBetter, 0);
49 // 0.1 steps from 0 to 20 since it is the most common range. 47 // 0.1 steps from 0 to 20 since it is the most common range.
50 numericBuilder.addLinearBins(20, 200);
51 // Exponentially increasing steps from 20 to 200. 48 // Exponentially increasing steps from 20 to 200.
52 numericBuilder.addExponentialBins(200, 100); 49 var CUSTOM_BOUNDARIES = tr.v.HistogramBinBoundaries.createLinear(0, 20, 200)
50 .addExponentialBins(200, 100);
53 51
54 function createNumericForTopEventTime() { 52 function createNumericForTopEventTime() {
55 var n = numericBuilder.build(); 53 var n = new tr.v.Histogram(
54 timeDurationInMs_smallerIsBetter, CUSTOM_BOUNDARIES);
56 n.customizeSummaryOptions({ 55 n.customizeSummaryOptions({
57 avg: true, 56 avg: true,
58 count: true, 57 count: true,
59 max: true, 58 max: true,
60 min: false, 59 min: false,
61 std: true, 60 std: true,
62 sum: true, 61 sum: true,
63 percentile: [0.90]}); 62 percentile: [0.90]});
64 return n; 63 return n;
65 } 64 }
66 65
67 function createNumericForIdleTime() { 66 function createNumericForIdleTime() {
68 var n = numericBuilder.build(); 67 var n = new tr.v.Histogram(
68 timeDurationInMs_smallerIsBetter, CUSTOM_BOUNDARIES);
69 n.customizeSummaryOptions({ 69 n.customizeSummaryOptions({
70 avg: true, 70 avg: true,
71 count: false, 71 count: false,
72 max: true, 72 max: true,
73 min: false, 73 min: false,
74 std: false, 74 std: false,
75 sum: true, 75 sum: true,
76 percentile: [] 76 percentile: []
77 }); 77 });
78 return n; 78 return n;
79 } 79 }
80 80
81 var PERCENTAGE_BUILDER = tr.v.NumericBuilder.createLinear(
82 percentage_biggerIsBetter,
83 tr.b.Range.fromExplicitRange(0, 1), 20);
84
85 function createPercentage(numerator, denominator) { 81 function createPercentage(numerator, denominator) {
86 var histogram = PERCENTAGE_BUILDER.build(); 82 var histogram = new tr.v.Histogram(percentage_biggerIsBetter);
87 if (denominator === 0) 83 if (denominator === 0)
88 histogram.add(0); 84 histogram.add(0);
89 else 85 else
90 histogram.add(numerator / denominator); 86 histogram.add(numerator / denominator);
91 return histogram; 87 return histogram;
92 } 88 }
93 89
94 /** 90 /**
95 * Example output: 91 * Example output:
96 * - blink-gc-marking. 92 * - blink-gc-marking.
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 cpuDuration.sum); 193 cpuDuration.sum);
198 values.addValue(new tr.v.NumericValue( 194 values.addValue(new tr.v.NumericValue(
199 name + '_percentage_idle', percentage)); 195 name + '_percentage_idle', percentage));
200 } 196 }
201 197
202 return { 198 return {
203 blinkGcMetric: blinkGcMetric 199 blinkGcMetric: blinkGcMetric
204 }; 200 };
205 }); 201 });
206 </script> 202 </script>
OLDNEW
« no previous file with comments | « trace_processor/experimental/mappers/trace_stats.html ('k') | tracing/tracing/metrics/cpu_process_metric.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698