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/metrics/metric_registry.html"> | 8 <link rel="import" href="/tracing/metrics/metric_registry.html"> |
9 <link rel="import" href="/tracing/metrics/system_health/utils.html"> | 9 <link rel="import" href="/tracing/metrics/system_health/utils.html"> |
10 <link rel="import" href="/tracing/model/model.html"> | 10 <link rel="import" href="/tracing/model/model.html"> |
11 <link rel="import" href="/tracing/value/histogram.html"> | 11 <link rel="import" href="/tracing/value/histogram.html"> |
12 <link rel="import" href="/tracing/value/value.html"> | |
13 | 12 |
14 <script> | 13 <script> |
15 'use strict'; | 14 'use strict'; |
16 | 15 |
17 tr.exportTo('tr.metrics.sh', function() { | 16 tr.exportTo('tr.metrics.sh', function() { |
18 function syncIsComplete(markers) { | 17 function syncIsComplete(markers) { |
19 return markers.length === 2; | 18 return markers.length === 2; |
20 } | 19 } |
21 | 20 |
22 function syncInvolvesTelemetry(markers) { | 21 function syncInvolvesTelemetry(markers) { |
(...skipping 12 matching lines...) Expand all Loading... |
35 continue; | 34 continue; |
36 | 35 |
37 for (var marker of markers) { | 36 for (var marker of markers) { |
38 var domain = marker.domainId; | 37 var domain = marker.domainId; |
39 if (domain === tr.model.ClockDomainId.TELEMETRY) | 38 if (domain === tr.model.ClockDomainId.TELEMETRY) |
40 latency = (marker.endTs - marker.startTs); | 39 latency = (marker.endTs - marker.startTs); |
41 else | 40 else |
42 targetDomain = domain.toLowerCase(); | 41 targetDomain = domain.toLowerCase(); |
43 } | 42 } |
44 | 43 |
45 var hist = new tr.v.Histogram( | 44 var hist = new tr.v.Histogram('clock_sync_latency_' + targetDomain, |
46 tr.b.Unit.byName.timeDurationInMs_smallerIsBetter, | 45 tr.b.Unit.byName.timeDurationInMs_smallerIsBetter, |
47 tr.v.HistogramBinBoundaries.createExponential(1e-3, 1e3, 30)); | 46 tr.v.HistogramBinBoundaries.createExponential(1e-3, 1e3, 30)); |
| 47 hist.description = 'Clock sync latency for domain ' + targetDomain; |
48 hist.addSample(latency); | 48 hist.addSample(latency); |
49 values.addValue(new tr.v.NumericValue( | 49 values.addHistogram(hist); |
50 'clock_sync_latency_' + targetDomain, hist, | |
51 {description: 'Clock sync latency for domain ' + targetDomain})); | |
52 } | 50 } |
53 } | 51 } |
54 | 52 |
55 tr.metrics.MetricRegistry.register(clockSyncLatencyMetric); | 53 tr.metrics.MetricRegistry.register(clockSyncLatencyMetric); |
56 | 54 |
57 return { | 55 return { |
58 clockSyncLatencyMetric: clockSyncLatencyMetric | 56 clockSyncLatencyMetric: clockSyncLatencyMetric |
59 }; | 57 }; |
60 }); | 58 }); |
61 </script> | 59 </script> |
OLD | NEW |