OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2015 The Chromium Authors. All rights reserved. | 3 Copyright (c) 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="/tracing/base/math/range_utils.html"> | 8 <link rel="import" href="/tracing/base/math/range_utils.html"> |
9 <link rel="import" href="/tracing/base/math/statistics.html"> | 9 <link rel="import" href="/tracing/base/math/statistics.html"> |
10 <link rel="import" href="/tracing/base/unit.html"> | 10 <link rel="import" href="/tracing/base/unit.html"> |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 CSS: 'CSS', | 44 CSS: 'CSS', |
45 WEBGL: 'WebGL', | 45 WEBGL: 'WebGL', |
46 VIDEO: 'Video' | 46 VIDEO: 'Video' |
47 }; | 47 }; |
48 | 48 |
49 UserExpectation.prototype = { | 49 UserExpectation.prototype = { |
50 __proto__: tr.model.TimedEvent.prototype, | 50 __proto__: tr.model.TimedEvent.prototype, |
51 | 51 |
52 computeCompoundEvenSelectionState: function(selection) { | 52 computeCompoundEvenSelectionState: function(selection) { |
53 var cess = CompoundEventSelectionState.NOT_SELECTED; | 53 var cess = CompoundEventSelectionState.NOT_SELECTED; |
54 if (selection.contains(this)) | 54 if (selection.contains(this)) { |
55 cess |= CompoundEventSelectionState.EVENT_SELECTED; | 55 cess |= CompoundEventSelectionState.EVENT_SELECTED; |
| 56 } |
56 | 57 |
57 if (this.associatedEvents.intersectionIsEmpty(selection)) | 58 if (this.associatedEvents.intersectionIsEmpty(selection)) { |
58 return cess; | 59 return cess; |
| 60 } |
59 | 61 |
60 var allContained = this.associatedEvents.every(function(event) { | 62 var allContained = this.associatedEvents.every(function(event) { |
61 return selection.contains(event); | 63 return selection.contains(event); |
62 }); | 64 }); |
63 | 65 |
64 if (allContained) | 66 if (allContained) { |
65 cess |= CompoundEventSelectionState.ALL_ASSOCIATED_EVENTS_SELECTED; | 67 cess |= CompoundEventSelectionState.ALL_ASSOCIATED_EVENTS_SELECTED; |
66 else | 68 } else { |
67 cess |= CompoundEventSelectionState.SOME_ASSOCIATED_EVENTS_SELECTED; | 69 cess |= CompoundEventSelectionState.SOME_ASSOCIATED_EVENTS_SELECTED; |
| 70 } |
68 return cess; | 71 return cess; |
69 }, | 72 }, |
70 | 73 |
71 // Returns samples which are overlapping with V8.Execute | 74 // Returns samples which are overlapping with V8.Execute |
72 get associatedSamples() { | 75 get associatedSamples() { |
73 var samples = new tr.model.EventSet(); | 76 var samples = new tr.model.EventSet(); |
74 this.associatedEvents.forEach(function(event) { | 77 this.associatedEvents.forEach(function(event) { |
75 if (event instanceof tr.model.ThreadSlice) | 78 if (event instanceof tr.model.ThreadSlice) { |
76 samples.addEventSet(event.overlappingSamples); | 79 samples.addEventSet(event.overlappingSamples); |
| 80 } |
77 }); | 81 }); |
78 return samples; | 82 return samples; |
79 }, | 83 }, |
80 | 84 |
81 get userFriendlyName() { | 85 get userFriendlyName() { |
82 return this.title + ' User Expectation at ' + | 86 return this.title + ' User Expectation at ' + |
83 tr.b.Unit.byName.timeStampInMs.format(this.start); | 87 tr.b.Unit.byName.timeStampInMs.format(this.start); |
84 }, | 88 }, |
85 | 89 |
86 get stableId() { | 90 get stableId() { |
87 return ('UserExpectation.' + this.guid); | 91 return ('UserExpectation.' + this.guid); |
88 }, | 92 }, |
89 | 93 |
90 get typeInfo() { | 94 get typeInfo() { |
91 if (!this.typeInfo_) { | 95 if (!this.typeInfo_) { |
92 this.typeInfo_ = UserExpectation.subTypes.findTypeInfo( | 96 this.typeInfo_ = UserExpectation.subTypes.findTypeInfo( |
93 this.constructor); | 97 this.constructor); |
94 } | 98 } |
95 | 99 |
96 // If you set Subclass.prototype = {}, then you must explicitly specify | 100 // If you set Subclass.prototype = {}, then you must explicitly specify |
97 // constructor in that prototype object! | 101 // constructor in that prototype object! |
98 // http://javascript.info/tutorial/constructor | 102 // http://javascript.info/tutorial/constructor |
99 | 103 |
100 if (!this.typeInfo_) | 104 if (!this.typeInfo_) { |
101 throw new Error('Unregistered UserExpectation'); | 105 throw new Error('Unregistered UserExpectation'); |
| 106 } |
102 | 107 |
103 return this.typeInfo_; | 108 return this.typeInfo_; |
104 }, | 109 }, |
105 | 110 |
106 get colorId() { | 111 get colorId() { |
107 return this.typeInfo.metadata.colorId; | 112 return this.typeInfo.metadata.colorId; |
108 }, | 113 }, |
109 | 114 |
110 get stageTitle() { | 115 get stageTitle() { |
111 return this.typeInfo.metadata.stageTitle; | 116 return this.typeInfo.metadata.stageTitle; |
112 }, | 117 }, |
113 | 118 |
114 get initiatorType() { | 119 get initiatorType() { |
115 return this.initiatorType_; | 120 return this.initiatorType_; |
116 }, | 121 }, |
117 | 122 |
118 get title() { | 123 get title() { |
119 if (!this.initiatorType) | 124 if (!this.initiatorType) { |
120 return this.stageTitle; | 125 return this.stageTitle; |
| 126 } |
121 | 127 |
122 return this.initiatorType + ' ' + this.stageTitle; | 128 return this.initiatorType + ' ' + this.stageTitle; |
123 }, | 129 }, |
124 | 130 |
125 /** | 131 /** |
126 * Returns the sum of the number of CPU ms spent by this UserExpectation. | 132 * Returns the sum of the number of CPU ms spent by this UserExpectation. |
127 */ | 133 */ |
128 get totalCpuMs() { | 134 get totalCpuMs() { |
129 var cpuMs = 0; | 135 var cpuMs = 0; |
130 this.associatedEvents.forEach(function(event) { | 136 this.associatedEvents.forEach(function(event) { |
131 if (event.cpuSelfTime) | 137 if (event.cpuSelfTime) { |
132 cpuMs += event.cpuSelfTime; | 138 cpuMs += event.cpuSelfTime; |
| 139 } |
133 }); | 140 }); |
134 return cpuMs; | 141 return cpuMs; |
135 } | 142 } |
136 }; | 143 }; |
137 | 144 |
138 var subTypes = {}; | 145 var subTypes = {}; |
139 var options = new tr.b.ExtensionRegistryOptions(tr.b.BASIC_REGISTRY_MODE); | 146 var options = new tr.b.ExtensionRegistryOptions(tr.b.BASIC_REGISTRY_MODE); |
140 tr.b.decorateExtensionRegistry(subTypes, options); | 147 tr.b.decorateExtensionRegistry(subTypes, options); |
141 | 148 |
142 subTypes.addEventListener('will-register', function(e) { | 149 subTypes.addEventListener('will-register', function(e) { |
(...skipping 17 matching lines...) Expand all Loading... |
160 pluralName: 'userExpectations', | 167 pluralName: 'userExpectations', |
161 subTypes: subTypes | 168 subTypes: subTypes |
162 }); | 169 }); |
163 | 170 |
164 return { | 171 return { |
165 UserExpectation, | 172 UserExpectation, |
166 INITIATOR_TYPE, | 173 INITIATOR_TYPE, |
167 }; | 174 }; |
168 }); | 175 }); |
169 </script> | 176 </script> |
OLD | NEW |