| 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/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.sh', function() { | 16 tr.exportTo('tr.metrics.sh', function() { |
| 17 var NUMERIC_BUILDER = tr.v.NumericBuilder.createExponential( | |
| 18 tr.v.Unit.byName.timeDurationInMs_smallerIsBetter, | |
| 19 tr.b.Range.fromExplicitRange(1e-3, 1e6), 50); | |
| 20 | |
| 21 function webviewStartupMetric(values, model) { | 17 function webviewStartupMetric(values, model) { |
| 22 var startupWallHist = NUMERIC_BUILDER.build(); | 18 var startupWallHist = new tr.v.Histogram( |
| 23 var startupCPUHist = NUMERIC_BUILDER.build(); | 19 tr.v.Unit.byName.timeDurationInMs_smallerIsBetter); |
| 24 var loadWallHist = NUMERIC_BUILDER.build(); | 20 var startupCPUHist = new tr.v.Histogram( |
| 25 var loadCPUHist = NUMERIC_BUILDER.build(); | 21 tr.v.Unit.byName.timeDurationInMs_smallerIsBetter); |
| 22 var loadWallHist = new tr.v.Histogram( |
| 23 tr.v.Unit.byName.timeDurationInMs_smallerIsBetter); |
| 24 var loadCPUHist = new tr.v.Histogram( |
| 25 tr.v.Unit.byName.timeDurationInMs_smallerIsBetter); |
| 26 | 26 |
| 27 // TODO(alexandermont): Only iterate over the processes and threads that | 27 // TODO(alexandermont): Only iterate over the processes and threads that |
| 28 // could contain these events. | 28 // could contain these events. |
| 29 for (var slice of model.getDescendantEvents()) { | 29 for (var slice of model.getDescendantEvents()) { |
| 30 if (!(slice instanceof tr.model.ThreadSlice)) | 30 if (!(slice instanceof tr.model.ThreadSlice)) |
| 31 continue; | 31 continue; |
| 32 | 32 |
| 33 // WebViewStartupInterval is the title of the section of code that is | 33 // WebViewStartupInterval is the title of the section of code that is |
| 34 // entered (via android.os.Trace.beginSection) when WebView is started | 34 // entered (via android.os.Trace.beginSection) when WebView is started |
| 35 // up. This value is defined in TelemetryActivity.java. | 35 // up. This value is defined in TelemetryActivity.java. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 57 loadCPUHist, {description: 'WebView blank URL load CPU time'})); | 57 loadCPUHist, {description: 'WebView blank URL load CPU time'})); |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 tr.metrics.MetricRegistry.register(webviewStartupMetric); | 60 tr.metrics.MetricRegistry.register(webviewStartupMetric); |
| 61 | 61 |
| 62 return { | 62 return { |
| 63 webviewStartupMetric: webviewStartupMetric | 63 webviewStartupMetric: webviewStartupMetric |
| 64 }; | 64 }; |
| 65 }); | 65 }); |
| 66 </script> | 66 </script> |
| OLD | NEW |