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/extras/chrome/chrome_user_friendly_category_dr
iver.html"> | 8 <link rel="import" href="/tracing/extras/chrome/chrome_user_friendly_category_dr
iver.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/model/helpers/chrome_model_helper.html"> | 10 <link rel="import" href="/tracing/model/helpers/chrome_model_helper.html"> |
11 <link rel="import" href="/tracing/value/histogram.html"> | 11 <link rel="import" href="/tracing/value/histogram.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 LONG_TASK_MS = 50; | 17 var LONG_TASK_MS = 50; |
18 | 18 |
19 // Anything longer than this should be so rare that its length beyond this is | 19 // Anything longer than this should be so rare that its length beyond this is |
20 // uninteresting. | 20 // uninteresting. |
21 var LONGEST_TASK_MS = 1000; | 21 var LONGEST_TASK_MS = 1000; |
22 | 22 |
23 /** | 23 /** |
24 * This helper function calls |cb| for each of the top-level tasks on the | 24 * This helper function calls |cb| for each of the top-level tasks on the |
25 * given thread in the given range whose duration is longer than LONG_TASK_MS. | 25 * given thread in the given range whose duration is longer than LONG_TASK_MS. |
26 * | 26 * |
27 * @param {tr.model.Thread} thread | 27 * @param {tr.model.Thread} thread |
28 * @param {tr.b.Range=} opt_range | 28 * @param {tr.b.math.Range=} opt_range |
29 * @param {function()} cb | 29 * @param {function()} cb |
30 * @param {Object=} opt_this | 30 * @param {Object=} opt_this |
31 */ | 31 */ |
32 function iterateLongTopLevelTasksOnThreadInRange( | 32 function iterateLongTopLevelTasksOnThreadInRange( |
33 thread, opt_range, cb, opt_this) { | 33 thread, opt_range, cb, opt_this) { |
34 thread.sliceGroup.topLevelSlices.forEach(function(slice) { | 34 thread.sliceGroup.topLevelSlices.forEach(function(slice) { |
35 if (opt_range && | 35 if (opt_range && |
36 !opt_range.intersectsExplicitRangeInclusive(slice.start, slice.end)) | 36 !opt_range.intersectsExplicitRangeInclusive(slice.start, slice.end)) |
37 return; | 37 return; |
38 | 38 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 return { | 109 return { |
110 longTasksMetric, | 110 longTasksMetric, |
111 iterateLongTopLevelTasksOnThreadInRange, | 111 iterateLongTopLevelTasksOnThreadInRange, |
112 iterateRendererMainThreads, | 112 iterateRendererMainThreads, |
113 LONG_TASK_MS, | 113 LONG_TASK_MS, |
114 LONGEST_TASK_MS, | 114 LONGEST_TASK_MS, |
115 }; | 115 }; |
116 }); | 116 }); |
117 </script> | 117 </script> |
OLD | NEW |