| 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/value/histogram.html"> | 9 <link rel="import" href="/tracing/value/histogram.html"> |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 var process = model.processes[pid]; | 29 var process = model.processes[pid]; |
| 30 var processCpuTime = 0; | 30 var processCpuTime = 0; |
| 31 for (var tid in process.threads) { | 31 for (var tid in process.threads) { |
| 32 var thread = process.threads[tid]; | 32 var thread = process.threads[tid]; |
| 33 var threadCpuTime = 0; | 33 var threadCpuTime = 0; |
| 34 thread.sliceGroup.topLevelSlices.forEach(function(slice) { | 34 thread.sliceGroup.topLevelSlices.forEach(function(slice) { |
| 35 if (rangeOfInterest && | 35 if (rangeOfInterest && |
| 36 !rangeOfInterest.intersectsExplicitRangeInclusive( | 36 !rangeOfInterest.intersectsExplicitRangeInclusive( |
| 37 slice.start, slice.end)) | 37 slice.start, slice.end)) |
| 38 return; | 38 return; |
| 39 if ((typeof slice.cpuDuration !== 'number') || |
| 40 isNaN(slice.cpuDuration)) { |
| 41 console.error(slice.cpuDuration, slice.title, slice.category); |
| 42 return; |
| 43 } |
| 39 threadCpuTime += slice.cpuDuration; | 44 threadCpuTime += slice.cpuDuration; |
| 40 }); | 45 }); |
| 41 processCpuTime += threadCpuTime; | 46 processCpuTime += threadCpuTime; |
| 42 } | 47 } |
| 43 allProcessCpuTime += processCpuTime; | 48 allProcessCpuTime += processCpuTime; |
| 44 } | 49 } |
| 45 | 50 |
| 46 // Normalize cpu time by clock time. | 51 // Normalize cpu time by clock time. |
| 47 var normalizationRange = rangeOfInterest ? | 52 var normalizationRange = rangeOfInterest ? |
| 48 rangeOfInterest : model.bounds.range; | 53 rangeOfInterest : model.bounds.range; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 66 | 71 |
| 67 tr.metrics.MetricRegistry.register(cpuTimeMetric, { | 72 tr.metrics.MetricRegistry.register(cpuTimeMetric, { |
| 68 supportsRangeOfInterest: true | 73 supportsRangeOfInterest: true |
| 69 }); | 74 }); |
| 70 | 75 |
| 71 return { | 76 return { |
| 72 cpuTimeMetric: cpuTimeMetric, | 77 cpuTimeMetric: cpuTimeMetric, |
| 73 }; | 78 }; |
| 74 }); | 79 }); |
| 75 </script> | 80 </script> |
| OLD | NEW |