| 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/raf.html"> | 8 <link rel="import" href="/tracing/base/raf.html"> |
| 9 <link rel="import" href="/tracing/metrics/metric_map_function.html"> | 9 <link rel="import" href="/tracing/metrics/metric_map_function.html"> |
| 10 <link rel="import" href="/tracing/metrics/metric_registry.html"> | 10 <link rel="import" href="/tracing/metrics/metric_registry.html"> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 ready: function() { | 49 ready: function() { |
| 50 this.model_ = undefined; | 50 this.model_ = undefined; |
| 51 | 51 |
| 52 this.rangeOfInterest_ = undefined; | 52 this.rangeOfInterest_ = undefined; |
| 53 this.metricLatenciesMs_ = []; | 53 this.metricLatenciesMs_ = []; |
| 54 | 54 |
| 55 this.metrics_ = []; | 55 this.metrics_ = []; |
| 56 tr.metrics.MetricRegistry.getAllRegisteredTypeInfos().forEach( | 56 tr.metrics.MetricRegistry.getAllRegisteredTypeInfos().forEach( |
| 57 function(m) { | 57 function(m) { |
| 58 if (m.constructor.name === 'sampleMetric') | 58 if (m.constructor.name === 'sampleMetric') return; |
| 59 return; | 59 |
| 60 this.metrics_.push({ | 60 this.metrics_.push({ |
| 61 label: m.constructor.name, | 61 label: m.constructor.name, |
| 62 value: m.constructor.name | 62 value: m.constructor.name |
| 63 }); | 63 }); |
| 64 }, this); | 64 }, this); |
| 65 | 65 |
| 66 this.settingsKey_ = 'metrics-side-panel-metric-name'; | 66 this.settingsKey_ = 'metrics-side-panel-metric-name'; |
| 67 this.currentMetricName_ = 'responsivenessMetric'; | 67 this.currentMetricName_ = 'responsivenessMetric'; |
| 68 var metricSelector = tr.ui.b.createSelector( | 68 var metricSelector = tr.ui.b.createSelector( |
| 69 this, 'currentMetricName_', | 69 this, 'currentMetricName_', |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 if (!this.model_) { | 174 if (!this.model_) { |
| 175 Polymer.dom(this.$.error).textContent = 'Missing model'; | 175 Polymer.dom(this.$.error).textContent = 'Missing model'; |
| 176 return; | 176 return; |
| 177 } | 177 } |
| 178 | 178 |
| 179 var options = {metrics: [this.currentMetricName_]}; | 179 var options = {metrics: [this.currentMetricName_]}; |
| 180 | 180 |
| 181 if (this.currentMetricTypeInfo_ && | 181 if (this.currentMetricTypeInfo_ && |
| 182 this.currentMetricTypeInfo_.metadata.supportsRangeOfInterest && | 182 this.currentMetricTypeInfo_.metadata.supportsRangeOfInterest && |
| 183 this.rangeOfInterest && | 183 this.rangeOfInterest && |
| 184 !this.rangeOfInterest.isEmpty) | 184 !this.rangeOfInterest.isEmpty) { |
| 185 options.rangeOfInterest = this.rangeOfInterest; | 185 options.rangeOfInterest = this.rangeOfInterest; |
| 186 } |
| 186 | 187 |
| 187 var startDate = new Date(); | 188 var startDate = new Date(); |
| 188 try { | 189 try { |
| 189 var histograms = tr.metrics.runMetrics(this.model_, options); | 190 var histograms = tr.metrics.runMetrics(this.model_, options); |
| 190 } catch (err) { | 191 } catch (err) { |
| 191 Polymer.dom(this.$.error).textContent = err.message; | 192 Polymer.dom(this.$.error).textContent = err.message; |
| 192 return; | 193 return; |
| 193 } | 194 } |
| 194 | 195 |
| 195 this.metricLatenciesMs_.push(new Date() - startDate); | 196 this.metricLatenciesMs_.push(new Date() - startDate); |
| 196 while (this.metricLatenciesMs_.length > 20) | 197 while (this.metricLatenciesMs_.length > 20) { |
| 197 this.metricLatenciesMs_.shift(); | 198 this.metricLatenciesMs_.shift(); |
| 199 } |
| 198 | 200 |
| 199 this.recomputeButton_.style.background = ''; | 201 this.recomputeButton_.style.background = ''; |
| 200 | 202 |
| 201 this.$.results.style.display = ''; | 203 this.$.results.style.display = ''; |
| 202 this.$.results.histograms = histograms; | 204 this.$.results.histograms = histograms; |
| 203 } | 205 } |
| 204 }); | 206 }); |
| 205 | 207 |
| 206 tr.ui.side_panel.SidePanelRegistry.register(function() { | 208 tr.ui.side_panel.SidePanelRegistry.register(function() { |
| 207 return document.createElement('tr-ui-sp-metrics-side-panel'); | 209 return document.createElement('tr-ui-sp-metrics-side-panel'); |
| 208 }); | 210 }); |
| 209 | 211 |
| 210 return {}; | 212 return {}; |
| 211 }); | 213 }); |
| 212 </script> | 214 </script> |
| OLD | NEW |