OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright 2017 The Chromium Authors. All rights reserved. | 3 Copyright 2017 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/timing.html"> |
8 <link rel="import" href="/tracing/value/histogram_grouping.html"> | 9 <link rel="import" href="/tracing/value/histogram_grouping.html"> |
9 <link rel="import" href="/tracing/value/histogram_set.html"> | 10 <link rel="import" href="/tracing/value/histogram_set.html"> |
10 | 11 |
11 <script> | 12 <script> |
12 'use strict'; | 13 'use strict'; |
13 tr.exportTo('tr.v', function() { | 14 tr.exportTo('tr.v', function() { |
14 const getDisplayLabel = | 15 const getDisplayLabel = |
15 tr.v.HistogramGrouping.DISPLAY_LABEL.callback; | 16 tr.v.HistogramGrouping.DISPLAY_LABEL.callback; |
16 | 17 |
17 const DEFAULT_POSSIBLE_GROUPS = []; | 18 const DEFAULT_POSSIBLE_GROUPS = []; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 this.keysToValues_ = new Map(DEFAULT_POSSIBLE_GROUPS.map( | 51 this.keysToValues_ = new Map(DEFAULT_POSSIBLE_GROUPS.map( |
51 g => [g.key, new Set()])); | 52 g => [g.key, new Set()])); |
52 | 53 |
53 // Never remove 'name' from keysToGroupings. | 54 // Never remove 'name' from keysToGroupings. |
54 this.keysToValues_.delete( | 55 this.keysToValues_.delete( |
55 tr.v.HistogramGrouping.HISTOGRAM_NAME.key); | 56 tr.v.HistogramGrouping.HISTOGRAM_NAME.key); |
56 } | 57 } |
57 | 58 |
58 process(histograms) { | 59 process(histograms) { |
59 const allStoryTags = new Set(); | 60 const allStoryTags = new Set(); |
| 61 let maxSampleCount = 0; |
60 for (const hist of histograms) { | 62 for (const hist of histograms) { |
| 63 maxSampleCount = Math.max(maxSampleCount, hist.numValues); |
| 64 |
61 for (const statName of hist.statisticsNames) { | 65 for (const statName of hist.statisticsNames) { |
62 this.statisticNames_.add(statName); | 66 this.statisticNames_.add(statName); |
63 } | 67 } |
64 | 68 |
65 let startTime = hist.diagnostics.get( | 69 let startTime = hist.diagnostics.get( |
66 tr.v.d.RESERVED_NAMES.BENCHMARK_START); | 70 tr.v.d.RESERVED_NAMES.BENCHMARK_START); |
67 if (startTime !== undefined) startTime = startTime.minDate.getTime(); | 71 if (startTime !== undefined) startTime = startTime.minDate.getTime(); |
68 | 72 |
69 const telemetry = tr.v.d.TelemetryInfo.getFromHistogram(hist); | 73 const telemetry = tr.v.d.TelemetryInfo.getFromHistogram(hist); |
70 | 74 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // keysToValues_ | 120 // keysToValues_ |
117 const groupingKey = 'storyGroupingKey_' + key; | 121 const groupingKey = 'storyGroupingKey_' + key; |
118 if (this.keysToGroupings_.has(groupingKey)) continue; | 122 if (this.keysToGroupings_.has(groupingKey)) continue; |
119 const callback = tr.v.d.TelemetryInfo.makeStoryGroupingKeyLabelGetter( | 123 const callback = tr.v.d.TelemetryInfo.makeStoryGroupingKeyLabelGetter( |
120 key); | 124 key); |
121 this.keysToGroupings_.set(groupingKey, new tr.v.HistogramGrouping( | 125 this.keysToGroupings_.set(groupingKey, new tr.v.HistogramGrouping( |
122 groupingKey, callback)); | 126 groupingKey, callback)); |
123 this.keysToValues_.set(groupingKey, new Set([callback(hist)])); | 127 this.keysToValues_.set(groupingKey, new Set([callback(hist)])); |
124 } | 128 } |
125 } | 129 } |
| 130 tr.b.Timing.instant( |
| 131 'HistogramParameterCollector', 'maxSampleCount', maxSampleCount); |
126 | 132 |
127 for (const tagGrouping of tr.v.HistogramGrouping.buildFromTags( | 133 for (const tagGrouping of tr.v.HistogramGrouping.buildFromTags( |
128 allStoryTags, tr.v.d.RESERVED_NAMES.STORY_TAGS)) { | 134 allStoryTags, tr.v.d.RESERVED_NAMES.STORY_TAGS)) { |
129 const values = new Set(); | 135 const values = new Set(); |
130 for (const hist of histograms) { | 136 for (const hist of histograms) { |
131 values.add(tagGrouping.callback(hist)); | 137 values.add(tagGrouping.callback(hist)); |
132 } | 138 } |
133 if (values.size > 1) { | 139 if (values.size > 1) { |
134 this.keysToGroupings_.set(tagGrouping.key, tagGrouping); | 140 this.keysToGroupings_.set(tagGrouping.key, tagGrouping); |
135 this.keysToValues_.set(tagGrouping.key, values); | 141 this.keysToValues_.set(tagGrouping.key, values); |
(...skipping 22 matching lines...) Expand all Loading... |
158 | 164 |
159 return Array.from(this.keysToGroupings_.values()); | 165 return Array.from(this.keysToGroupings_.values()); |
160 } | 166 } |
161 } | 167 } |
162 | 168 |
163 return { | 169 return { |
164 HistogramParameterCollector, | 170 HistogramParameterCollector, |
165 }; | 171 }; |
166 }); | 172 }); |
167 </script> | 173 </script> |
OLD | NEW |