OLD | NEW |
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/value/diagnostics/add_related_names.html"> | 9 <link rel="import" href="/tracing/value/diagnostics/add_related_names.html"> |
10 <link rel="import" href="/tracing/value/histogram.html"> | 10 <link rel="import" href="/tracing/value/histogram.html"> |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 * @param {string} guid | 145 * @param {string} guid |
146 * @return {!tr.v.d.Diagnostic|undefined} | 146 * @return {!tr.v.d.Diagnostic|undefined} |
147 */ | 147 */ |
148 lookupDiagnostic(guid) { | 148 lookupDiagnostic(guid) { |
149 return this.sharedDiagnosticsByGuid_.get(guid); | 149 return this.sharedDiagnosticsByGuid_.get(guid); |
150 } | 150 } |
151 | 151 |
152 resolveRelatedHistograms() { | 152 resolveRelatedHistograms() { |
153 const handleDiagnosticMap = dm => { | 153 const handleDiagnosticMap = dm => { |
154 for (const [name, diagnostic] of dm) { | 154 for (const [name, diagnostic] of dm) { |
155 if ((diagnostic instanceof tr.v.d.RelatedHistogramSet) || | 155 if (diagnostic instanceof tr.v.d.RelatedHistogramMap) { |
156 (diagnostic instanceof tr.v.d.RelatedHistogramMap)) { | |
157 diagnostic.resolve(this); | 156 diagnostic.resolve(this); |
158 } | 157 } |
159 } | 158 } |
160 }; | 159 }; |
161 | 160 |
162 for (const hist of this) { | 161 for (const hist of this) { |
163 hist.diagnostics.resolveSharedDiagnostics(this); | 162 hist.diagnostics.resolveSharedDiagnostics(this); |
164 | 163 |
165 handleDiagnosticMap(hist.diagnostics); | 164 handleDiagnosticMap(hist.diagnostics); |
166 | 165 |
167 for (const dm of hist.nanDiagnosticMaps) { | 166 for (const dm of hist.nanDiagnosticMaps) { |
168 handleDiagnosticMap(dm); | 167 handleDiagnosticMap(dm); |
169 } | 168 } |
170 | 169 |
171 for (const bin of hist.allBins) { | 170 for (const bin of hist.allBins) { |
172 for (const dm of bin.diagnosticMaps) { | 171 for (const dm of bin.diagnosticMaps) { |
173 handleDiagnosticMap(dm); | 172 handleDiagnosticMap(dm); |
174 } | 173 } |
175 } | 174 } |
176 } | 175 } |
177 } | 176 } |
178 | 177 |
179 /** | 178 /** |
180 * Convert dicts to either Histograms or shared Diagnostics. | 179 * Convert dicts to either Histograms or shared Diagnostics. |
181 * Does not resolve RelatedHistogramSet/RelatedHistogramMap diagnostics. See | 180 * Does not resolve RelatedHistogramMap diagnostics. See |
182 * resolveRelatedHistograms(). | 181 * resolveRelatedHistograms(). |
183 * | 182 * |
184 * @param {!Object} dicts | 183 * @param {!Object} dicts |
185 */ | 184 */ |
186 importDicts(dicts) { | 185 importDicts(dicts) { |
187 for (const dict of dicts) { | 186 for (const dict of dicts) { |
188 if (dict.type && tr.v.d.Diagnostic.findTypeInfoWithName(dict.type)) { | 187 if (dict.type && tr.v.d.Diagnostic.findTypeInfoWithName(dict.type)) { |
189 this.sharedDiagnosticsByGuid_.set(dict.guid, | 188 this.sharedDiagnosticsByGuid_.set(dict.guid, |
190 tr.v.d.Diagnostic.fromDict(dict)); | 189 tr.v.d.Diagnostic.fromDict(dict)); |
191 } else { | 190 } else { |
(...skipping 14 matching lines...) Expand all Loading... |
206 dicts.push(diagnostic.asDict()); | 205 dicts.push(diagnostic.asDict()); |
207 } | 206 } |
208 for (const hist of this) { | 207 for (const hist of this) { |
209 dicts.push(hist.asDict()); | 208 dicts.push(hist.asDict()); |
210 } | 209 } |
211 return dicts; | 210 return dicts; |
212 } | 211 } |
213 | 212 |
214 /** | 213 /** |
215 * Find the Histograms that are not contained in any other Histograms' | 214 * Find the Histograms that are not contained in any other Histograms' |
216 * RelatedHistogramSet or RelatedHistogramMap diagnostics. | 215 * RelatedHistogramMap diagnostics. |
217 * | 216 * |
218 * @return {!Array.<!tr.v.Histogram>} | 217 * @return {!Array.<!tr.v.Histogram>} |
219 */ | 218 */ |
220 get sourceHistograms() { | 219 get sourceHistograms() { |
221 const sourceHistograms = new Map(this.histogramsByGuid_); | 220 const sourceHistograms = new Map(this.histogramsByGuid_); |
222 // If a Histogram is in a RelatedHistogramSet or RelatedHistogramMap, | 221 // If a Histogram is in a RelatedHistogramMap, |
223 // which can be owned either by Histograms or by numeric samples, then it | 222 // which can be owned either by Histograms or by numeric samples, then it |
224 // is not a source Histogram. | 223 // is not a source Histogram. |
225 function deleteSourceHistograms(diagnosticMap) { | 224 function deleteSourceHistograms(diagnosticMap) { |
226 for (const [name, diagnostic] of diagnosticMap) { | 225 for (const [name, diagnostic] of diagnosticMap) { |
227 if (diagnostic instanceof tr.v.d.RelatedHistogramSet) { | 226 if (diagnostic instanceof tr.v.d.RelatedHistogramMap) { |
228 for (const relatedHist of diagnostic) { | |
229 sourceHistograms.delete(relatedHist.guid); | |
230 } | |
231 } else if (diagnostic instanceof tr.v.d.RelatedHistogramMap) { | |
232 for (const [name, relatedHist] of diagnostic) { | 227 for (const [name, relatedHist] of diagnostic) { |
233 sourceHistograms.delete(relatedHist.guid); | 228 sourceHistograms.delete(relatedHist.guid); |
234 } | 229 } |
235 } | 230 } |
236 } | 231 } |
237 } | 232 } |
238 | 233 |
239 for (const hist of this) { | 234 for (const hist of this) { |
240 deleteSourceHistograms(hist.diagnostics); | 235 deleteSourceHistograms(hist.diagnostics); |
241 for (const dm of hist.nanDiagnosticMaps) { | 236 for (const dm of hist.nanDiagnosticMaps) { |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 hist.diagnostics.mergeRelationships(hist); | 378 hist.diagnostics.mergeRelationships(hist); |
384 } | 379 } |
385 } | 380 } |
386 } | 381 } |
387 | 382 |
388 return { | 383 return { |
389 HistogramSet, | 384 HistogramSet, |
390 }; | 385 }; |
391 }); | 386 }); |
392 </script> | 387 </script> |
OLD | NEW |