OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2015 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2015 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/math/statistics.html"> | 8 <link rel="import" href="/tracing/base/math/statistics.html"> |
9 <link rel="import" href="/tracing/base/timing.html"> | 9 <link rel="import" href="/tracing/base/timing.html"> |
10 <link rel="import" href="/tracing/ui/base/box_chart.html"> | 10 <link rel="import" href="/tracing/ui/base/box_chart.html"> |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 Polymer({ | 84 Polymer({ |
85 is: 'tr-v-ui-histogram-span', | 85 is: 'tr-v-ui-histogram-span', |
86 | 86 |
87 created() { | 87 created() { |
88 this.viewStateListener_ = this.onViewStateUpdate_.bind(this); | 88 this.viewStateListener_ = this.onViewStateUpdate_.bind(this); |
89 this.viewState = new tr.v.ui.HistogramSetTableCellState(); | 89 this.viewState = new tr.v.ui.HistogramSetTableCellState(); |
90 this.rowStateListener_ = this.onRowStateUpdate_.bind(this); | 90 this.rowStateListener_ = this.onRowStateUpdate_.bind(this); |
91 this.rowState = new tr.v.ui.HistogramSetTableRowState(); | 91 this.rowState = new tr.v.ui.HistogramSetTableRowState(); |
92 | 92 |
| 93 this.alpha_ = undefined; |
| 94 this.anySampleDiagnostics_ = false; |
| 95 this.canMergeSampleDiagnostics_ = true; |
| 96 this.graphHeight_ = undefined; |
| 97 this.graphWidth_ = undefined; |
93 this.histogram_ = undefined; | 98 this.histogram_ = undefined; |
94 this.referenceHistogram_ = undefined; | 99 this.histograms_ = undefined; |
95 this.graphWidth_ = undefined; | |
96 this.graphHeight_ = undefined; | |
97 this.mouseDownBin_ = undefined; | 100 this.mouseDownBin_ = undefined; |
98 this.prevBrushedBinRange_ = new tr.b.math.Range(); | 101 this.prevBrushedBinRange_ = new tr.b.math.Range(); |
99 this.anySampleDiagnostics_ = false; | 102 this.referenceHistogram_ = undefined; |
100 this.canMergeSampleDiagnostics_ = true; | |
101 this.alpha_ = undefined; | |
102 }, | 103 }, |
103 | 104 |
104 get rowState() { | 105 get rowState() { |
105 return this.rowState_; | 106 return this.rowState_; |
106 }, | 107 }, |
107 | 108 |
108 set rowState(rs) { | 109 set rowState(rs) { |
109 if (this.rowState) { | 110 if (this.rowState) { |
110 this.rowState.removeUpdateListener(this.rowStateListener_); | 111 this.rowState.removeUpdateListener(this.rowStateListener_); |
111 } | 112 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 } | 159 } |
159 } | 160 } |
160 } | 161 } |
161 } | 162 } |
162 }, | 163 }, |
163 | 164 |
164 ready() { | 165 ready() { |
165 this.$.metric_diagnostics.tabLabel = 'histogram diagnostics'; | 166 this.$.metric_diagnostics.tabLabel = 'histogram diagnostics'; |
166 this.$.sample_diagnostics_container.tabLabel = 'sample diagnostics'; | 167 this.$.sample_diagnostics_container.tabLabel = 'sample diagnostics'; |
167 this.$.metadata_diagnostics.tabLabel = 'metadata'; | 168 this.$.metadata_diagnostics.tabLabel = 'metadata'; |
168 this.$.metadata_diagnostics.isMetadata = true; | 169 |
169 this.$.diagnostics.addEventListener( | 170 this.$.diagnostics.addEventListener( |
170 'selected-tab-change', this.onSelectedDiagnosticsChanged_.bind(this)); | 171 'selected-tab-change', this.onSelectedDiagnosticsChanged_.bind(this)); |
171 this.$.drag_handle.target = this.$.container; | 172 this.$.drag_handle.target = this.$.container; |
172 this.$.drag_handle.addEventListener( | 173 this.$.drag_handle.addEventListener( |
173 'drag-handle-resize', this.onResize_.bind(this)); | 174 'drag-handle-resize', this.onResize_.bind(this)); |
174 }, | 175 }, |
175 | 176 |
176 attached() { | 177 attached() { |
177 if (this.histogram_ !== undefined) this.updateContents_(); | 178 if (this.histogram_ !== undefined) this.updateContents_(); |
178 }, | 179 }, |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 }, | 349 }, |
349 | 350 |
350 updateDiagnostics_() { | 351 updateDiagnostics_() { |
351 let maps = []; | 352 let maps = []; |
352 for (const bin of this.brushedBins) { | 353 for (const bin of this.brushedBins) { |
353 for (const map of bin.diagnosticMaps) { | 354 for (const map of bin.diagnosticMaps) { |
354 maps.push(map); | 355 maps.push(map); |
355 } | 356 } |
356 } | 357 } |
357 | 358 |
| 359 this.$.merge_sample_diagnostics.disabled = maps.length === 1; |
| 360 |
358 if (this.$.merge_sample_diagnostics.checked !== | 361 if (this.$.merge_sample_diagnostics.checked !== |
359 this.viewState.mergeSampleDiagnostics) { | 362 this.viewState.mergeSampleDiagnostics) { |
360 this.viewState.update({ | 363 this.viewState.update({ |
361 mergeSampleDiagnostics: this.$.merge_sample_diagnostics.checked}); | 364 mergeSampleDiagnostics: this.$.merge_sample_diagnostics.checked}); |
362 } | 365 } |
363 | 366 |
364 if (this.viewState.mergeSampleDiagnostics) { | 367 if (this.viewState.mergeSampleDiagnostics && maps.length > 1) { |
365 const merged = new tr.v.d.DiagnosticMap(); | 368 const merged = new tr.v.d.DiagnosticMap(); |
366 for (const map of maps) { | 369 for (const map of maps) { |
367 merged.addDiagnostics(map); | 370 merged.addDiagnostics(map); |
368 } | 371 } |
369 maps = [merged]; | 372 maps = [merged]; |
370 } | 373 } |
371 | 374 |
372 const mark = tr.b.Timing.mark('histogram-span', | 375 const mark = tr.b.Timing.mark('histogram-span', |
373 (this.viewState.mergeSampleDiagnostics ? 'merge' : 'split') + | 376 (this.viewState.mergeSampleDiagnostics ? 'merge' : 'split') + |
374 'SampleDiagnostics'); | 377 'SampleDiagnostics'); |
375 this.$.sample_diagnostics.diagnosticMaps = maps; | 378 this.$.sample_diagnostics.build( |
| 379 maps, false, this.histogram_, this.histograms_); |
376 mark.end(); | 380 mark.end(); |
377 | 381 |
378 if (this.anySampleDiagnostics_) { | 382 if (this.anySampleDiagnostics_) { |
379 this.$.diagnostics.selectedSubView = | 383 this.$.diagnostics.selectedSubView = |
380 this.$.sample_diagnostics_container; | 384 this.$.sample_diagnostics_container; |
381 } | 385 } |
382 }, | 386 }, |
383 | 387 |
384 get histogram() { | 388 get histogram() { |
385 return this.histogram_; | 389 return this.histogram_; |
386 }, | 390 }, |
387 | 391 |
388 set histogram(histogram) { | 392 build(histogram, referenceHistogram, histograms) { |
389 if (histogram === this.histogram_) return; | |
390 this.histogram_ = histogram; | 393 this.histogram_ = histogram; |
391 this.$.metric_diagnostics.histogram = histogram; | 394 this.referenceHistogram_ = referenceHistogram; |
392 this.$.sample_diagnostics.histogram = histogram; | 395 this.histograms_ = histograms; |
393 | 396 |
394 this.anySampleDiagnostics_ = false; | 397 this.anySampleDiagnostics_ = false; |
395 for (const bin of this.histogram.allBins) { | 398 for (const bin of this.histogram.allBins) { |
396 if (bin.diagnosticMaps.length > 0) { | 399 if (bin.diagnosticMaps.length > 0) { |
397 this.anySampleDiagnostics_ = true; | 400 this.anySampleDiagnostics_ = true; |
398 break; | 401 break; |
399 } | 402 } |
400 } | 403 } |
401 | 404 |
402 if (this.isAttached) this.updateContents_(); | 405 if (this.isAttached) this.updateContents_(); |
403 }, | 406 }, |
404 | 407 |
405 get referenceHistogram() { | 408 get referenceHistogram() { |
406 return this.referenceHistogram_; | 409 return this.referenceHistogram_; |
407 }, | 410 }, |
408 | 411 |
409 set referenceHistogram(histogram) { | |
410 if (histogram === this.referenceHistogram_) { | |
411 return; | |
412 } | |
413 this.referenceHistogram_ = histogram; | |
414 if (this.histogram) this.updateContents_(); | |
415 }, | |
416 | |
417 set alpha(a) { | 412 set alpha(a) { |
418 if (tr.b.math.approximately(a, this.alpha_)) return; | 413 if (tr.b.math.approximately(a, this.alpha_)) return; |
419 this.alpha_ = a; | 414 this.alpha_ = a; |
420 if (this.referenceHistogram) this.updateContents_(); | 415 if (this.referenceHistogram) this.updateContents_(); |
421 }, | 416 }, |
422 | 417 |
423 getDeltaScalars_(statNames, scalarMap) { | 418 getDeltaScalars_(statNames, scalarMap) { |
424 if (!this.histogram.canCompare(this.referenceHistogram)) return; | 419 if (!this.histogram.canCompare(this.referenceHistogram)) return; |
425 | 420 |
426 const mwu = tr.b.math.Statistics.mwu( | 421 const mwu = tr.b.math.Statistics.mwu( |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 const scalarMap = new Map(); | 459 const scalarMap = new Map(); |
465 this.getDeltaScalars_(this.histogram.statisticsNames, scalarMap); | 460 this.getDeltaScalars_(this.histogram.statisticsNames, scalarMap); |
466 for (const [name, scalar] of this.histogram.statisticsScalars) { | 461 for (const [name, scalar] of this.histogram.statisticsScalars) { |
467 scalarMap.set(name, scalar); | 462 scalarMap.set(name, scalar); |
468 } | 463 } |
469 this.$.stats.scalarMap = scalarMap; | 464 this.$.stats.scalarMap = scalarMap; |
470 | 465 |
471 const metricDiagnosticMap = new tr.v.d.DiagnosticMap(); | 466 const metricDiagnosticMap = new tr.v.d.DiagnosticMap(); |
472 const metadataDiagnosticMap = new tr.v.d.DiagnosticMap(); | 467 const metadataDiagnosticMap = new tr.v.d.DiagnosticMap(); |
473 for (const [key, diagnostic] of this.histogram.diagnostics) { | 468 for (const [key, diagnostic] of this.histogram.diagnostics) { |
474 // Hide the 'mergedFrom' and 'mergedTo' diagnostics, which are | 469 // https://github.com/catapult-project/catapult/issues/2842 |
475 // implementation details. | 470 if (diagnostic instanceof tr.v.d.UnmergeableDiagnosticSet) continue; |
476 if (key === tr.v.d.RESERVED_NAMES.MERGED_FROM) continue; | 471 if (diagnostic instanceof tr.v.d.CollectedRelatedEventSet) continue; |
477 if (key === tr.v.d.RESERVED_NAMES.MERGED_TO) continue; | 472 if (diagnostic instanceof tr.v.d.GroupingPath) continue; |
| 473 if (diagnostic instanceof tr.v.d.RelatedNameMap) continue; |
| 474 |
478 if (tr.v.d.RESERVED_NAMES_SET.has(key)) { | 475 if (tr.v.d.RESERVED_NAMES_SET.has(key)) { |
479 metadataDiagnosticMap.set(key, diagnostic); | 476 metadataDiagnosticMap.set(key, diagnostic); |
480 } else { | 477 } else { |
481 metricDiagnosticMap.set(key, diagnostic); | 478 metricDiagnosticMap.set(key, diagnostic); |
482 } | 479 } |
483 } | 480 } |
484 | 481 |
485 const diagnosticTabs = []; | 482 const diagnosticTabs = []; |
486 if (metricDiagnosticMap.size) { | 483 if (metricDiagnosticMap.size) { |
487 this.$.metric_diagnostics.diagnosticMaps = [metricDiagnosticMap]; | 484 this.$.metric_diagnostics.build( |
| 485 [metricDiagnosticMap], false, this.histogram_, this.histograms_); |
488 diagnosticTabs.push(this.$.metric_diagnostics); | 486 diagnosticTabs.push(this.$.metric_diagnostics); |
489 } | 487 } |
490 if (this.anySampleDiagnostics_) { | 488 if (this.anySampleDiagnostics_) { |
491 diagnosticTabs.push(this.$.sample_diagnostics_container); | 489 diagnosticTabs.push(this.$.sample_diagnostics_container); |
492 } | 490 } |
493 if (metadataDiagnosticMap.size) { | 491 if (metadataDiagnosticMap.size) { |
494 this.$.metadata_diagnostics.diagnosticMaps = [metadataDiagnosticMap]; | 492 this.$.metadata_diagnostics.build( |
| 493 [metadataDiagnosticMap], true, this.histogram_, this.histograms_); |
495 diagnosticTabs.push(this.$.metadata_diagnostics); | 494 diagnosticTabs.push(this.$.metadata_diagnostics); |
496 } | 495 } |
497 this.$.diagnostics.resetSubViews(diagnosticTabs); | 496 this.$.diagnostics.resetSubViews(diagnosticTabs); |
498 this.$.diagnostics.set('tabsHidden', diagnosticTabs.length < 2); | 497 this.$.diagnostics.set('tabsHidden', diagnosticTabs.length < 2); |
499 | 498 |
500 if (this.histogram.numValues <= 1) { | 499 if (this.histogram.numValues <= 1) { |
501 await this.viewState.update({ | 500 await this.viewState.update({ |
502 brushedBinRange: tr.b.math.Range.fromExplicitRange( | 501 brushedBinRange: tr.b.math.Range.fromExplicitRange( |
503 0, this.histogram.allBins.length)}); | 502 0, this.histogram.allBins.length)}); |
504 this.$.container.style.justifyContent = 'flex-end'; | 503 this.$.container.style.justifyContent = 'flex-end'; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 } | 579 } |
581 this.chart_.overrideDataRange = dataRange; | 580 this.chart_.overrideDataRange = dataRange; |
582 | 581 |
583 this.chart_.data = chartData; | 582 this.chart_.data = chartData; |
584 this.$.stats_container.style.maxHeight = | 583 this.$.stats_container.style.maxHeight = |
585 this.chart_.getBoundingClientRect().height + 'px'; | 584 this.chart_.getBoundingClientRect().height + 'px'; |
586 } | 585 } |
587 }); | 586 }); |
588 }); | 587 }); |
589 </script> | 588 </script> |
OLD | NEW |