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/base/timing.html"> |
9 <link rel="import" href="/tracing/value/histogram_grouping.html"> | 9 <link rel="import" href="/tracing/value/histogram_grouping.html"> |
10 <link rel="import" href="/tracing/value/histogram_set.html"> | 10 <link rel="import" href="/tracing/value/histogram_set.html"> |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 maxSampleCount = Math.max(maxSampleCount, hist.numValues); | 63 maxSampleCount = Math.max(maxSampleCount, hist.numValues); |
64 | 64 |
65 for (const statName of hist.statisticsNames) { | 65 for (const statName of hist.statisticsNames) { |
66 this.statisticNames_.add(statName); | 66 this.statisticNames_.add(statName); |
67 } | 67 } |
68 | 68 |
69 let startTime = hist.diagnostics.get( | 69 let startTime = hist.diagnostics.get( |
70 tr.v.d.RESERVED_NAMES.BENCHMARK_START); | 70 tr.v.d.RESERVED_NAMES.BENCHMARK_START); |
71 if (startTime !== undefined) startTime = startTime.minDate.getTime(); | 71 if (startTime !== undefined) startTime = startTime.minDate.getTime(); |
72 | 72 |
73 const telemetry = tr.v.d.TelemetryInfo.getFromHistogram(hist); | |
74 | |
75 if (startTime === undefined && telemetry && telemetry.benchmarkStart) { | |
76 startTime = telemetry.benchmarkStart.getTime(); | |
77 } | |
78 | |
79 const displayLabel = getDisplayLabel(hist); | 73 const displayLabel = getDisplayLabel(hist); |
80 | 74 |
81 if (this.labelsToStartTimes_.has(displayLabel)) { | 75 if (this.labelsToStartTimes_.has(displayLabel)) { |
82 startTime = Math.min(startTime, | 76 startTime = Math.min(startTime, |
83 this.labelsToStartTimes_.get(displayLabel)); | 77 this.labelsToStartTimes_.get(displayLabel)); |
84 } | 78 } |
85 this.labelsToStartTimes_.set(displayLabel, startTime); | 79 this.labelsToStartTimes_.set(displayLabel, startTime); |
86 | 80 |
87 for (const [groupingKey, values] of this.keysToValues_) { | 81 for (const [groupingKey, values] of this.keysToValues_) { |
88 const grouping = this.keysToGroupings_.get(groupingKey); | 82 const grouping = this.keysToGroupings_.get(groupingKey); |
89 const value = grouping.callback(hist); | 83 const value = grouping.callback(hist); |
90 if (!value) continue; | 84 if (!value) continue; |
91 values.add(value); | 85 values.add(value); |
92 if (values.size > 1) { | 86 if (values.size > 1) { |
93 // This grouping will definitely stay in keysToGroupings_. We don't | 87 // This grouping will definitely stay in keysToGroupings_. We don't |
94 // need to see any more values in the rest of histograms. Remove | 88 // need to see any more values in the rest of histograms. Remove |
95 // this groupingKey from this.keysToValues_ so that we don't compute | 89 // this groupingKey from this.keysToValues_ so that we don't compute |
96 // it for any more histograms and so that we don't delete it from | 90 // it for any more histograms and so that we don't delete it from |
97 // keysToGroupings_. | 91 // keysToGroupings_. |
98 this.keysToValues_.delete(groupingKey); | 92 this.keysToValues_.delete(groupingKey); |
99 } | 93 } |
100 } | 94 } |
101 | 95 |
102 const storyTags = hist.diagnostics.get( | 96 const storyTags = hist.diagnostics.get( |
103 tr.v.d.RESERVED_NAMES.STORY_TAGS); | 97 tr.v.d.RESERVED_NAMES.STORY_TAGS); |
104 for (const tag of (storyTags || [])) { | 98 for (const tag of (storyTags || [])) { |
105 allStoryTags.add(tag); | 99 allStoryTags.add(tag); |
106 } | 100 } |
107 | |
108 if (!telemetry) continue; | |
109 | |
110 // Translate storyGroupingKeys like {cache_temp: 'cold'} into | |
111 // HistogramGroupings like { | |
112 // key: 'storyGroupingKey_cache_temp', | |
113 // callback: (a function that takes a Histogram and returns its | |
114 // TelemetryInfo.storyGroupingKeys.get('cache_temp')), | |
115 // } | |
116 | |
117 for (const [key, value] of telemetry.storyGroupingKeys) { | |
118 // If this storyGroupingKey is not yet known, then add a new | |
119 // HistogramGrouping to keysToGroupings_ and a new Set of values to | |
120 // keysToValues_ | |
121 const groupingKey = 'storyGroupingKey_' + key; | |
122 if (this.keysToGroupings_.has(groupingKey)) continue; | |
123 const callback = tr.v.d.TelemetryInfo.makeStoryGroupingKeyLabelGetter( | |
124 key); | |
125 this.keysToGroupings_.set(groupingKey, new tr.v.HistogramGrouping( | |
126 groupingKey, callback)); | |
127 this.keysToValues_.set(groupingKey, new Set([callback(hist)])); | |
128 } | |
129 } | 101 } |
130 tr.b.Timing.instant( | 102 tr.b.Timing.instant( |
131 'HistogramParameterCollector', 'maxSampleCount', maxSampleCount); | 103 'HistogramParameterCollector', 'maxSampleCount', maxSampleCount); |
132 | 104 |
133 for (const tagGrouping of tr.v.HistogramGrouping.buildFromTags( | 105 for (const tagGrouping of tr.v.HistogramGrouping.buildFromTags( |
134 allStoryTags, tr.v.d.RESERVED_NAMES.STORY_TAGS)) { | 106 allStoryTags, tr.v.d.RESERVED_NAMES.STORY_TAGS)) { |
135 const values = new Set(); | 107 const values = new Set(); |
136 for (const hist of histograms) { | 108 for (const hist of histograms) { |
137 values.add(tagGrouping.callback(hist)); | 109 values.add(tagGrouping.callback(hist)); |
138 } | 110 } |
(...skipping 25 matching lines...) Expand all Loading... |
164 | 136 |
165 return Array.from(this.keysToGroupings_.values()); | 137 return Array.from(this.keysToGroupings_.values()); |
166 } | 138 } |
167 } | 139 } |
168 | 140 |
169 return { | 141 return { |
170 HistogramParameterCollector, | 142 HistogramParameterCollector, |
171 }; | 143 }; |
172 }); | 144 }); |
173 </script> | 145 </script> |
OLD | NEW |