OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright 2015 The Chromium Authors. All rights reserved. | 3 Copyright 2015 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="/perf_insights/mre/function_handle.html"> | 8 <link rel="import" href="/perf_insights/mre/function_handle.html"> |
9 <link rel="import" href="/tracing/base/range.html"> | 9 <link rel="import" href="/tracing/base/math/range.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 | 11 |
12 <script> | 12 <script> |
13 'use strict'; | 13 'use strict'; |
14 | 14 |
15 tr.exportTo('pie', function() { | 15 tr.exportTo('pie', function() { |
16 // Collects the set of tasks that are preventing user input from being | 16 // Collects the set of tasks that are preventing user input from being |
17 // processed on the main thread. | 17 // processed on the main thread. |
18 // See https://goo.gl/l7V5xg. | 18 // See https://goo.gl/l7V5xg. |
19 function mapInputBlockers(result, model) { | 19 function mapInputBlockers(result, model) { |
(...skipping 18 matching lines...) Expand all Loading... |
38 for (var event of mainThread.getDescendantEvents()) { | 38 for (var event of mainThread.getDescendantEvents()) { |
39 if (event.title !== 'LatencyInfo.Flow' || | 39 if (event.title !== 'LatencyInfo.Flow' || |
40 event.args['step'] !== 'HandleInputEventMain' || | 40 event.args['step'] !== 'HandleInputEventMain' || |
41 event.inFlowEvents.length !== 1) { | 41 event.inFlowEvents.length !== 1) { |
42 continue; | 42 continue; |
43 } | 43 } |
44 | 44 |
45 // Now we can derive the queueing interval from the flow event. | 45 // Now we can derive the queueing interval from the flow event. |
46 var flowEvent = event.inFlowEvents[0]; | 46 var flowEvent = event.inFlowEvents[0]; |
47 var queueRange = | 47 var queueRange = |
48 tr.b.Range.fromExplicitRange(flowEvent.start, event.start); | 48 tr.b.math.Range.fromExplicitRange(flowEvent.start, event.start); |
49 | 49 |
50 // Find all events that intersect the queueing interval and compute how | 50 // Find all events that intersect the queueing interval and compute how |
51 // much they contributed to it. | 51 // much they contributed to it. |
52 for (var intersectingEvent of mainThread.getDescendantEvents()) { | 52 for (var intersectingEvent of mainThread.getDescendantEvents()) { |
53 var eventRange = | 53 var eventRange = |
54 tr.b.Range.fromExplicitRange(intersectingEvent.start, | 54 tr.b.math.Range.fromExplicitRange(intersectingEvent.start, |
55 intersectingEvent.start + intersectingEvent.duration); | 55 intersectingEvent.start + intersectingEvent.duration); |
56 var intersection = queueRange.findIntersection(eventRange); | 56 var intersection = queueRange.findIntersection(eventRange); |
57 if (intersection.isEmpty || intersection.duration === 0) | 57 if (intersection.isEmpty || intersection.duration === 0) |
58 continue; | 58 continue; |
59 if (inputBlockers[intersectingEvent.title] === undefined) | 59 if (inputBlockers[intersectingEvent.title] === undefined) |
60 inputBlockers[intersectingEvent.title] = []; | 60 inputBlockers[intersectingEvent.title] = []; |
61 inputBlockers[intersectingEvent.title].push(intersection.duration); | 61 inputBlockers[intersectingEvent.title].push(intersection.duration); |
62 foundInputBlockers = true; | 62 foundInputBlockers = true; |
63 } | 63 } |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
67 if (!foundInputBlockers) { | 67 if (!foundInputBlockers) { |
68 result.addPair('inputBlockers', null); | 68 result.addPair('inputBlockers', null); |
69 return; | 69 return; |
70 } | 70 } |
71 | 71 |
72 result.addPair('inputBlockers', inputBlockers); | 72 result.addPair('inputBlockers', inputBlockers); |
73 } | 73 } |
74 | 74 |
75 pi.FunctionRegistry.register(mapInputBlockers); | 75 pi.FunctionRegistry.register(mapInputBlockers); |
76 | 76 |
77 return { | 77 return { |
78 mapInputBlockersForTest: mapInputBlockers | 78 mapInputBlockersForTest: mapInputBlockers |
79 }; | 79 }; |
80 }); | 80 }); |
81 </script> | 81 </script> |
OLD | NEW |