OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 this.internalFuncName = internalFuncName; | 162 this.internalFuncName = internalFuncName; |
163 this.totalTime = totalTime; | 163 this.totalTime = totalTime; |
164 this.selfTime = selfTime; | 164 this.selfTime = selfTime; |
165 this.head = head; | 165 this.head = head; |
166 this.parent = null; | 166 this.parent = null; |
167 this.children = []; | 167 this.children = []; |
168 }; | 168 }; |
169 | 169 |
170 | 170 |
171 /** | 171 /** |
172 * Returns a share of the function's total time in application's total time. | |
173 */ | |
174 ProfileView.Node.prototype.__defineGetter__( | |
175 'totalPercent', | |
176 function() { return this.totalTime / | |
177 (this.head ? this.head.totalTime : this.totalTime) * 100.0; }); | |
178 | |
179 | |
180 /** | |
181 * Returns a share of the function's self time in application's total time. | |
182 */ | |
183 ProfileView.Node.prototype.__defineGetter__( | |
184 'selfPercent', | |
185 function() { return this.selfTime / | |
186 (this.head ? this.head.totalTime : this.totalTime) * 100.0; }); | |
187 | |
188 | |
189 /** | |
190 * Returns a share of the function's total time in its parent's total time. | 172 * Returns a share of the function's total time in its parent's total time. |
191 */ | 173 */ |
192 ProfileView.Node.prototype.__defineGetter__( | 174 ProfileView.Node.prototype.__defineGetter__( |
193 'parentTotalPercent', | 175 'parentTotalPercent', |
194 function() { return this.totalTime / | 176 function() { return this.totalTime / |
195 (this.parent ? this.parent.totalTime : this.totalTime) * 100.0; }); | 177 (this.parent ? this.parent.totalTime : this.totalTime) * 100.0; }); |
196 | 178 |
197 | 179 |
198 /** | 180 /** |
199 * Adds a child to the node. | 181 * Adds a child to the node. |
(...skipping 10 matching lines...) Expand all Loading... |
210 * Sorts all the node's children recursively. | 192 * Sorts all the node's children recursively. |
211 * | 193 * |
212 * @param {function(ProfileView.Node, | 194 * @param {function(ProfileView.Node, |
213 * ProfileView.Node):number} sortFunc A sorting | 195 * ProfileView.Node):number} sortFunc A sorting |
214 * functions. Must comply with Array.sort sorting function requirements. | 196 * functions. Must comply with Array.sort sorting function requirements. |
215 */ | 197 */ |
216 ProfileView.Node.prototype.sortChildren = function( | 198 ProfileView.Node.prototype.sortChildren = function( |
217 sortFunc) { | 199 sortFunc) { |
218 this.children.sort(sortFunc); | 200 this.children.sort(sortFunc); |
219 }; | 201 }; |
OLD | NEW |