| 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/core/test_utils.html"> | 8 <link rel="import" href="/tracing/core/test_utils.html"> |
| 9 <link rel="import" href="/tracing/extras/chrome/chrome_test_utils.html"> | 9 <link rel="import" href="/tracing/extras/chrome/chrome_test_utils.html"> |
| 10 <link rel="import" href="/tracing/metrics/system_health/cpu_time_metric.html"> | 10 <link rel="import" href="/tracing/metrics/system_health/cpu_time_metric.html"> |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 var histograms = new tr.v.HistogramSet(); | 83 var histograms = new tr.v.HistogramSet(); |
| 84 tr.metrics.sh.cpuTimeMetric(histograms, model); | 84 tr.metrics.sh.cpuTimeMetric(histograms, model); |
| 85 var value = tr.b.getOnlyElement(histograms).average; | 85 var value = tr.b.getOnlyElement(histograms).average; |
| 86 assert.closeTo(value, 0.5, 0.001); | 86 assert.closeTo(value, 0.5, 0.001); |
| 87 }); | 87 }); |
| 88 | 88 |
| 89 // Makes sure that rangeOfInterest works correctly. | 89 // Makes sure that rangeOfInterest works correctly. |
| 90 test('cpuTimeMetric_oneProcess_rangeOfInterest', function() { | 90 test('cpuTimeMetric_oneProcess_rangeOfInterest', function() { |
| 91 var sliceDuration = 50; | 91 var sliceDuration = 50; |
| 92 var totalDuration = 3000; | 92 var totalDuration = 3000; |
| 93 var rangeOfInterest = new tr.b.Range.fromExplicitRange(-10, 30); | 93 var rangeOfInterest = new tr.b.math.Range.fromExplicitRange(-10, 30); |
| 94 var options = {}; | 94 var options = {}; |
| 95 options.rangeOfInterest = rangeOfInterest; | 95 options.rangeOfInterest = rangeOfInterest; |
| 96 var value = computeCpuTime(function(model) { | 96 var value = computeCpuTime(function(model) { |
| 97 model.rendererProcess = model.getOrCreateProcess(2); | 97 model.rendererProcess = model.getOrCreateProcess(2); |
| 98 model.rendererMain = model.rendererProcess.getOrCreateThread(3); | 98 model.rendererMain = model.rendererProcess.getOrCreateThread(3); |
| 99 model.rendererMain.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({ | 99 model.rendererMain.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({ |
| 100 type: tr.model.ThreadSlice, | 100 type: tr.model.ThreadSlice, |
| 101 isTopLevel: true, | 101 isTopLevel: true, |
| 102 start: 0, | 102 start: 0, |
| 103 duration: sliceDuration, | 103 duration: sliceDuration, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 start: 0, | 150 start: 0, |
| 151 duration: sliceDuration, | 151 duration: sliceDuration, |
| 152 cpuStart: 0, | 152 cpuStart: 0, |
| 153 cpuDuration: sliceDuration, | 153 cpuDuration: sliceDuration, |
| 154 })); | 154 })); |
| 155 }); | 155 }); |
| 156 assert.closeTo(value, 0.05, 0.001); | 156 assert.closeTo(value, 0.05, 0.001); |
| 157 }); | 157 }); |
| 158 }); | 158 }); |
| 159 </script> | 159 </script> |
| OLD | NEW |