| 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/range.html"> | 8 <link rel="import" href="/tracing/base/range.html"> |
| 9 <link rel="import" href="/tracing/metrics/metric_registry.html"> | 9 <link rel="import" href="/tracing/metrics/metric_registry.html"> |
| 10 <link rel="import" href="/tracing/value/histogram.html"> | 10 <link rel="import" href="/tracing/value/histogram.html"> |
| 11 <link rel="import" href="/tracing/value/value.html"> | 11 <link rel="import" href="/tracing/value/value.html"> |
| 12 | 12 |
| 13 <script> | 13 <script> |
| 14 'use strict'; | 14 'use strict'; |
| 15 | 15 |
| 16 tr.exportTo('tr.metrics', function() { | 16 tr.exportTo('tr.metrics', function() { |
| 17 function sampleMetric(values, model) { | 17 function sampleMetric(values, model) { |
| 18 var hist = new tr.v.Histogram(tr.v.Unit.byName.sizeInBytes_smallerIsBetter); | 18 var hist = new tr.v.Histogram(tr.v.Unit.byName.sizeInBytes_smallerIsBetter); |
| 19 hist.add(9); | 19 hist.addSample(9); |
| 20 hist.add(91); | 20 hist.addSample(91, {bar: new tr.v.d.Generic({hello: 42})}); |
| 21 |
| 22 for (var expectation of model.userModel.expectations) { |
| 23 if (expectation instanceof tr.model.um.ResponseExpectation) { |
| 24 } else if (expectation instanceof tr.model.um.AnimationExpectation) { |
| 25 } else if (expectation instanceof tr.model.um.IdleExpectation) { |
| 26 } else if (expectation instanceof tr.model.um.LoadExpectation) { |
| 27 } |
| 28 } |
| 29 |
| 30 var chromeHelper = model.getOrCreateHelper( |
| 31 tr.model.helpers.ChromeModelHelper); |
| 32 |
| 33 tr.b.iterItems(model.processes, function(pid, process) { |
| 34 }); |
| 35 |
| 21 values.addValue(new tr.v.NumericValue('foo', hist)); | 36 values.addValue(new tr.v.NumericValue('foo', hist)); |
| 22 } | 37 } |
| 23 | 38 |
| 24 tr.metrics.MetricRegistry.register(sampleMetric); | 39 tr.metrics.MetricRegistry.register(sampleMetric); |
| 25 | 40 |
| 26 return { | 41 return { |
| 27 sampleMetric: sampleMetric | 42 sampleMetric: sampleMetric |
| 28 }; | 43 }; |
| 29 }); | 44 }); |
| 30 </script> | 45 </script> |
| OLD | NEW |