| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| 11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
| 12 * | 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 |
| 27 /** |
| 28 * @constructor |
| 29 * @param {!ProfilerAgent.CPUProfile} profile |
| 30 */ |
| 31 WebInspector.CPUProfileDataModel = function(profile) |
| 32 { |
| 33 this.profileHead = profile.head; |
| 34 this.samples = profile.samples; |
| 35 this._calculateTimes(profile); |
| 36 this._assignParentsInProfile(); |
| 37 if (this.samples) |
| 38 this._buildIdToNodeMap(); |
| 39 } |
| 40 |
| 41 WebInspector.CPUProfileDataModel.prototype = { |
| 42 /** |
| 43 * @param {!ProfilerAgent.CPUProfile} profile |
| 44 */ |
| 45 _calculateTimes: function(profile) |
| 46 { |
| 47 function totalHitCount(node) { |
| 48 var result = node.hitCount; |
| 49 for (var i = 0; i < node.children.length; i++) |
| 50 result += totalHitCount(node.children[i]); |
| 51 return result; |
| 52 } |
| 53 profile.totalHitCount = totalHitCount(profile.head); |
| 54 |
| 55 var durationMs = 1000 * (profile.endTime - profile.startTime); |
| 56 var samplingInterval = durationMs / profile.totalHitCount; |
| 57 this.samplingIntervalMs = samplingInterval; |
| 58 |
| 59 function calculateTimesForNode(node) { |
| 60 node.selfTime = node.hitCount * samplingInterval; |
| 61 var totalHitCount = node.hitCount; |
| 62 for (var i = 0; i < node.children.length; i++) |
| 63 totalHitCount += calculateTimesForNode(node.children[i]); |
| 64 node.totalTime = totalHitCount * samplingInterval; |
| 65 return totalHitCount; |
| 66 } |
| 67 calculateTimesForNode(profile.head); |
| 68 }, |
| 69 |
| 70 _assignParentsInProfile: function() |
| 71 { |
| 72 var head = this.profileHead; |
| 73 head.parent = null; |
| 74 head.head = null; |
| 75 var nodesToTraverse = [ head ]; |
| 76 while (nodesToTraverse.length) { |
| 77 var parent = nodesToTraverse.pop(); |
| 78 var children = parent.children; |
| 79 var length = children.length; |
| 80 for (var i = 0; i < length; ++i) { |
| 81 var child = children[i]; |
| 82 child.head = head; |
| 83 child.parent = parent; |
| 84 if (child.children.length) |
| 85 nodesToTraverse.push(child); |
| 86 } |
| 87 } |
| 88 }, |
| 89 |
| 90 _buildIdToNodeMap: function() |
| 91 { |
| 92 /** @type {!Object.<number, !ProfilerAgent.CPUProfileNode>} */ |
| 93 this._idToNode = {}; |
| 94 var idToNode = this._idToNode; |
| 95 var stack = [this.profileHead]; |
| 96 while (stack.length) { |
| 97 var node = stack.pop(); |
| 98 idToNode[node.id] = node; |
| 99 for (var i = 0; i < node.children.length; i++) |
| 100 stack.push(node.children[i]); |
| 101 } |
| 102 |
| 103 var topLevelNodes = this.profileHead.children; |
| 104 for (var i = 0; i < topLevelNodes.length; i++) { |
| 105 var node = topLevelNodes[i]; |
| 106 if (node.functionName === "(garbage collector)") { |
| 107 this._gcNode = node; |
| 108 break; |
| 109 } |
| 110 } |
| 111 } |
| 112 } |
| 113 |
| 114 |
| 26 /** | 115 /** |
| 27 * @constructor | 116 * @constructor |
| 28 * @extends {WebInspector.VBox} | 117 * @extends {WebInspector.VBox} |
| 29 * @param {!WebInspector.CPUProfileHeader} profileHeader | 118 * @param {!WebInspector.CPUProfileHeader} profileHeader |
| 30 */ | 119 */ |
| 31 WebInspector.CPUProfileView = function(profileHeader) | 120 WebInspector.CPUProfileView = function(profileHeader) |
| 32 { | 121 { |
| 33 WebInspector.VBox.call(this); | 122 WebInspector.VBox.call(this); |
| 34 this.element.classList.add("cpu-profile-view"); | 123 this.element.classList.add("cpu-profile-view"); |
| 35 | 124 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 65 this.excludeButton = new WebInspector.StatusBarButton(WebInspector.UIString(
"Exclude selected function."), "exclude-profile-node-status-bar-item"); | 154 this.excludeButton = new WebInspector.StatusBarButton(WebInspector.UIString(
"Exclude selected function."), "exclude-profile-node-status-bar-item"); |
| 66 this.excludeButton.setEnabled(false); | 155 this.excludeButton.setEnabled(false); |
| 67 this.excludeButton.addEventListener("click", this._excludeClicked, this); | 156 this.excludeButton.addEventListener("click", this._excludeClicked, this); |
| 68 this._statusBarButtonsElement.appendChild(this.excludeButton.element); | 157 this._statusBarButtonsElement.appendChild(this.excludeButton.element); |
| 69 | 158 |
| 70 this.resetButton = new WebInspector.StatusBarButton(WebInspector.UIString("R
estore all functions."), "reset-profile-status-bar-item"); | 159 this.resetButton = new WebInspector.StatusBarButton(WebInspector.UIString("R
estore all functions."), "reset-profile-status-bar-item"); |
| 71 this.resetButton.visible = false; | 160 this.resetButton.visible = false; |
| 72 this.resetButton.addEventListener("click", this._resetClicked, this); | 161 this.resetButton.addEventListener("click", this._resetClicked, this); |
| 73 this._statusBarButtonsElement.appendChild(this.resetButton.element); | 162 this._statusBarButtonsElement.appendChild(this.resetButton.element); |
| 74 | 163 |
| 75 this.profileHead = /** @type {?ProfilerAgent.CPUProfileNode} */ (null); | 164 this._profileHeader = profileHeader; |
| 76 this.profile = profileHeader; | |
| 77 | |
| 78 this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.Defa
ultFormatter(30)); | 165 this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.Defa
ultFormatter(30)); |
| 79 | 166 |
| 80 if (this.profile._profile) // If the profile has been loaded from file then
use it. | 167 this.profile = new WebInspector.CPUProfileDataModel(profileHeader._profile |
| profileHeader.protocolProfile()); |
| 81 this._processProfileData(this.profile._profile); | 168 |
| 82 else | 169 this._changeView(); |
| 83 this._processProfileData(this.profile.protocolProfile()); | 170 if (this._flameChart) |
| 171 this._flameChart.update(); |
| 84 } | 172 } |
| 85 | 173 |
| 86 WebInspector.CPUProfileView._TypeFlame = "Flame"; | 174 WebInspector.CPUProfileView._TypeFlame = "Flame"; |
| 87 WebInspector.CPUProfileView._TypeTree = "Tree"; | 175 WebInspector.CPUProfileView._TypeTree = "Tree"; |
| 88 WebInspector.CPUProfileView._TypeHeavy = "Heavy"; | 176 WebInspector.CPUProfileView._TypeHeavy = "Heavy"; |
| 89 | 177 |
| 90 WebInspector.CPUProfileView.prototype = { | 178 WebInspector.CPUProfileView.prototype = { |
| 91 /** | 179 /** |
| 92 * @param {!number} timeLeft | 180 * @param {!number} timeLeft |
| 93 * @param {!number} timeRight | 181 * @param {!number} timeRight |
| 94 */ | 182 */ |
| 95 selectRange: function(timeLeft, timeRight) | 183 selectRange: function(timeLeft, timeRight) |
| 96 { | 184 { |
| 97 if (!this._flameChart) | 185 if (!this._flameChart) |
| 98 return; | 186 return; |
| 99 this._flameChart.selectRange(timeLeft, timeRight); | 187 this._flameChart.selectRange(timeLeft, timeRight); |
| 100 }, | 188 }, |
| 101 | 189 |
| 102 /** | |
| 103 * @param {?ProfilerAgent.CPUProfile} profile | |
| 104 */ | |
| 105 _processProfileData: function(profile) | |
| 106 { | |
| 107 this.profileHead = profile.head; | |
| 108 this.samples = profile.samples; | |
| 109 | |
| 110 this._calculateTimes(profile); | |
| 111 | |
| 112 this._assignParentsInProfile(); | |
| 113 if (this.samples) | |
| 114 this._buildIdToNodeMap(); | |
| 115 this._changeView(); | |
| 116 if (this._flameChart) | |
| 117 this._flameChart.update(); | |
| 118 }, | |
| 119 | |
| 120 get statusBarItems() | 190 get statusBarItems() |
| 121 { | 191 { |
| 122 return [this.viewSelectComboBox.element, this._statusBarButtonsElement]; | 192 return [this.viewSelectComboBox.element, this._statusBarButtonsElement]; |
| 123 }, | 193 }, |
| 124 | 194 |
| 125 /** | 195 /** |
| 126 * @return {!WebInspector.ProfileDataGridTree} | 196 * @return {!WebInspector.ProfileDataGridTree} |
| 127 */ | 197 */ |
| 128 _getBottomUpProfileDataGridTree: function() | 198 _getBottomUpProfileDataGridTree: function() |
| 129 { | 199 { |
| 130 if (!this._bottomUpProfileDataGridTree) | 200 if (!this._bottomUpProfileDataGridTree) |
| 131 this._bottomUpProfileDataGridTree = new WebInspector.BottomUpProfile
DataGridTree(this, /** @type {!ProfilerAgent.CPUProfileNode} */ (this.profileHea
d)); | 201 this._bottomUpProfileDataGridTree = new WebInspector.BottomUpProfile
DataGridTree(this, /** @type {!ProfilerAgent.CPUProfileNode} */ (this.profile.pr
ofileHead)); |
| 132 return this._bottomUpProfileDataGridTree; | 202 return this._bottomUpProfileDataGridTree; |
| 133 }, | 203 }, |
| 134 | 204 |
| 135 /** | 205 /** |
| 136 * @return {!WebInspector.ProfileDataGridTree} | 206 * @return {!WebInspector.ProfileDataGridTree} |
| 137 */ | 207 */ |
| 138 _getTopDownProfileDataGridTree: function() | 208 _getTopDownProfileDataGridTree: function() |
| 139 { | 209 { |
| 140 if (!this._topDownProfileDataGridTree) | 210 if (!this._topDownProfileDataGridTree) |
| 141 this._topDownProfileDataGridTree = new WebInspector.TopDownProfileDa
taGridTree(this, /** @type {!ProfilerAgent.CPUProfileNode} */ (this.profileHead)
); | 211 this._topDownProfileDataGridTree = new WebInspector.TopDownProfileDa
taGridTree(this, /** @type {!ProfilerAgent.CPUProfileNode} */ (this.profile.prof
ileHead)); |
| 142 return this._topDownProfileDataGridTree; | 212 return this._topDownProfileDataGridTree; |
| 143 }, | 213 }, |
| 144 | 214 |
| 145 willHide: function() | 215 willHide: function() |
| 146 { | 216 { |
| 147 this._currentSearchResultIndex = -1; | 217 this._currentSearchResultIndex = -1; |
| 148 }, | 218 }, |
| 149 | 219 |
| 150 refresh: function() | 220 refresh: function() |
| 151 { | 221 { |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 return; | 433 return; |
| 364 | 434 |
| 365 var profileNode = searchResult.profileNode; | 435 var profileNode = searchResult.profileNode; |
| 366 profileNode.revealAndSelect(); | 436 profileNode.revealAndSelect(); |
| 367 }, | 437 }, |
| 368 | 438 |
| 369 _ensureFlameChartCreated: function() | 439 _ensureFlameChartCreated: function() |
| 370 { | 440 { |
| 371 if (this._flameChart) | 441 if (this._flameChart) |
| 372 return; | 442 return; |
| 373 this._dataProvider = new WebInspector.CPUFlameChartDataProvider(this); | 443 this._dataProvider = new WebInspector.CPUFlameChartDataProvider(this.pro
file, this._profileHeader.target()); |
| 374 this._flameChart = new WebInspector.CPUProfileFlameChart(this._dataProvi
der); | 444 this._flameChart = new WebInspector.CPUProfileFlameChart(this._dataProvi
der); |
| 375 this._flameChart.addEventListener(WebInspector.FlameChart.Events.EntrySe
lected, this._onEntrySelected.bind(this)); | 445 this._flameChart.addEventListener(WebInspector.FlameChart.Events.EntrySe
lected, this._onEntrySelected.bind(this)); |
| 376 }, | 446 }, |
| 377 | 447 |
| 378 /** | 448 /** |
| 379 * @param {!WebInspector.Event} event | 449 * @param {!WebInspector.Event} event |
| 380 */ | 450 */ |
| 381 _onEntrySelected: function(event) | 451 _onEntrySelected: function(event) |
| 382 { | 452 { |
| 383 var entryIndex = event.data; | 453 var entryIndex = event.data; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 "self": "selfTime", | 556 "self": "selfTime", |
| 487 "total": "totalTime", | 557 "total": "totalTime", |
| 488 "function": "functionName" | 558 "function": "functionName" |
| 489 }[sortColumnIdentifier]; | 559 }[sortColumnIdentifier]; |
| 490 | 560 |
| 491 this.profileDataGridTree.sort(WebInspector.ProfileDataGridTree.propertyC
omparator(sortProperty, sortAscending)); | 561 this.profileDataGridTree.sort(WebInspector.ProfileDataGridTree.propertyC
omparator(sortProperty, sortAscending)); |
| 492 | 562 |
| 493 this.refresh(); | 563 this.refresh(); |
| 494 }, | 564 }, |
| 495 | 565 |
| 496 _calculateTimes: function(profile) | |
| 497 { | |
| 498 function totalHitCount(node) { | |
| 499 var result = node.hitCount; | |
| 500 for (var i = 0; i < node.children.length; i++) | |
| 501 result += totalHitCount(node.children[i]); | |
| 502 return result; | |
| 503 } | |
| 504 profile.totalHitCount = totalHitCount(profile.head); | |
| 505 | |
| 506 var durationMs = 1000 * (profile.endTime - profile.startTime); | |
| 507 var samplingInterval = durationMs / profile.totalHitCount; | |
| 508 this.samplingIntervalMs = samplingInterval; | |
| 509 | |
| 510 function calculateTimesForNode(node) { | |
| 511 node.selfTime = node.hitCount * samplingInterval; | |
| 512 var totalHitCount = node.hitCount; | |
| 513 for (var i = 0; i < node.children.length; i++) | |
| 514 totalHitCount += calculateTimesForNode(node.children[i]); | |
| 515 node.totalTime = totalHitCount * samplingInterval; | |
| 516 return totalHitCount; | |
| 517 } | |
| 518 calculateTimesForNode(profile.head); | |
| 519 }, | |
| 520 | |
| 521 _assignParentsInProfile: function() | |
| 522 { | |
| 523 var head = this.profileHead; | |
| 524 head.parent = null; | |
| 525 head.head = null; | |
| 526 var nodesToTraverse = [ head ]; | |
| 527 while (nodesToTraverse.length) { | |
| 528 var parent = nodesToTraverse.pop(); | |
| 529 var children = parent.children; | |
| 530 var length = children.length; | |
| 531 for (var i = 0; i < length; ++i) { | |
| 532 var child = children[i]; | |
| 533 child.head = head; | |
| 534 child.parent = parent; | |
| 535 if (child.children.length) | |
| 536 nodesToTraverse.push(child); | |
| 537 } | |
| 538 } | |
| 539 }, | |
| 540 | |
| 541 _buildIdToNodeMap: function() | |
| 542 { | |
| 543 /** @type {!Object.<string, !ProfilerAgent.CPUProfileNode>} */ | |
| 544 this._idToNode = {}; | |
| 545 var idToNode = this._idToNode; | |
| 546 var stack = [this.profileHead]; | |
| 547 while (stack.length) { | |
| 548 var node = stack.pop(); | |
| 549 idToNode[node.id] = node; | |
| 550 for (var i = 0; i < node.children.length; i++) | |
| 551 stack.push(node.children[i]); | |
| 552 } | |
| 553 | |
| 554 var topLevelNodes = this.profileHead.children; | |
| 555 for (var i = 0; i < topLevelNodes.length; i++) { | |
| 556 var node = topLevelNodes[i]; | |
| 557 if (node.functionName === "(garbage collector)") { | |
| 558 this._gcNode = node; | |
| 559 break; | |
| 560 } | |
| 561 } | |
| 562 }, | |
| 563 | |
| 564 __proto__: WebInspector.VBox.prototype | 566 __proto__: WebInspector.VBox.prototype |
| 565 } | 567 } |
| 566 | 568 |
| 567 /** | 569 /** |
| 568 * @constructor | 570 * @constructor |
| 569 * @extends {WebInspector.ProfileType} | 571 * @extends {WebInspector.ProfileType} |
| 570 * @implements {WebInspector.CPUProfilerModel.Delegate} | 572 * @implements {WebInspector.CPUProfilerModel.Delegate} |
| 571 */ | 573 */ |
| 572 WebInspector.CPUProfileType = function() | 574 WebInspector.CPUProfileType = function() |
| 573 { | 575 { |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 colorGenerator.colorForID("(program)::0", 50); | 993 colorGenerator.colorForID("(program)::0", 50); |
| 992 colorGenerator.colorForID("(garbage collector)::0", 50); | 994 colorGenerator.colorForID("(garbage collector)::0", 50); |
| 993 WebInspector.CPUProfileView._colorGenerator = colorGenerator; | 995 WebInspector.CPUProfileView._colorGenerator = colorGenerator; |
| 994 } | 996 } |
| 995 return WebInspector.CPUProfileView._colorGenerator; | 997 return WebInspector.CPUProfileView._colorGenerator; |
| 996 } | 998 } |
| 997 | 999 |
| 998 /** | 1000 /** |
| 999 * @constructor | 1001 * @constructor |
| 1000 * @implements {WebInspector.FlameChartDataProvider} | 1002 * @implements {WebInspector.FlameChartDataProvider} |
| 1001 * @param {!WebInspector.CPUProfileView} cpuProfileView | 1003 * @param {!WebInspector.CPUProfileDataModel} cpuProfile |
| 1004 * @param {!WebInspector.Target} target |
| 1002 */ | 1005 */ |
| 1003 WebInspector.CPUFlameChartDataProvider = function(cpuProfileView) | 1006 WebInspector.CPUFlameChartDataProvider = function(cpuProfile, target) |
| 1004 { | 1007 { |
| 1005 WebInspector.FlameChartDataProvider.call(this); | 1008 WebInspector.FlameChartDataProvider.call(this); |
| 1006 this._cpuProfileView = cpuProfileView; | 1009 this._cpuProfile = cpuProfile; |
| 1010 this._target = target; |
| 1007 this._colorGenerator = WebInspector.CPUProfileView.colorGenerator(); | 1011 this._colorGenerator = WebInspector.CPUProfileView.colorGenerator(); |
| 1008 } | 1012 } |
| 1009 | 1013 |
| 1010 WebInspector.CPUFlameChartDataProvider.prototype = { | 1014 WebInspector.CPUFlameChartDataProvider.prototype = { |
| 1011 /** | 1015 /** |
| 1012 * @return {number} | 1016 * @return {number} |
| 1013 */ | 1017 */ |
| 1014 barHeight: function() | 1018 barHeight: function() |
| 1015 { | 1019 { |
| 1016 return 15; | 1020 return 15; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1048 zeroTime: function() | 1052 zeroTime: function() |
| 1049 { | 1053 { |
| 1050 return 0; | 1054 return 0; |
| 1051 }, | 1055 }, |
| 1052 | 1056 |
| 1053 /** | 1057 /** |
| 1054 * @return {number} | 1058 * @return {number} |
| 1055 */ | 1059 */ |
| 1056 totalTime: function() | 1060 totalTime: function() |
| 1057 { | 1061 { |
| 1058 return this._cpuProfileView.profileHead.totalTime; | 1062 return this._cpuProfile.profileHead.totalTime; |
| 1059 }, | 1063 }, |
| 1060 | 1064 |
| 1061 /** | 1065 /** |
| 1062 * @return {number} | 1066 * @return {number} |
| 1063 */ | 1067 */ |
| 1064 maxStackDepth: function() | 1068 maxStackDepth: function() |
| 1065 { | 1069 { |
| 1066 return this._maxStackDepth; | 1070 return this._maxStackDepth; |
| 1067 }, | 1071 }, |
| 1068 | 1072 |
| 1069 /** | 1073 /** |
| 1070 * @return {?WebInspector.FlameChart.TimelineData} | 1074 * @return {?WebInspector.FlameChart.TimelineData} |
| 1071 */ | 1075 */ |
| 1072 timelineData: function() | 1076 timelineData: function() |
| 1073 { | 1077 { |
| 1074 return this._timelineData || this._calculateTimelineData(); | 1078 return this._timelineData || this._calculateTimelineData(); |
| 1075 }, | 1079 }, |
| 1076 | 1080 |
| 1077 /** | 1081 /** |
| 1078 * @return {?WebInspector.FlameChart.TimelineData} | 1082 * @return {?WebInspector.FlameChart.TimelineData} |
| 1079 */ | 1083 */ |
| 1080 _calculateTimelineData: function() | 1084 _calculateTimelineData: function() |
| 1081 { | 1085 { |
| 1082 if (!this._cpuProfileView.profileHead) | 1086 if (!this._cpuProfile.profileHead) |
| 1083 return null; | 1087 return null; |
| 1084 | 1088 |
| 1085 var samples = this._cpuProfileView.samples; | 1089 var samples = this._cpuProfile.samples; |
| 1086 var idToNode = this._cpuProfileView._idToNode; | 1090 var idToNode = this._cpuProfile._idToNode; |
| 1087 var gcNode = this._cpuProfileView._gcNode; | 1091 var gcNode = this._cpuProfile._gcNode; |
| 1088 var samplesCount = samples.length; | 1092 var samplesCount = samples.length; |
| 1089 var samplingInterval = this._cpuProfileView.samplingIntervalMs; | 1093 var samplingInterval = this._cpuProfile.samplingIntervalMs; |
| 1090 | 1094 |
| 1091 var index = 0; | 1095 var index = 0; |
| 1092 | 1096 |
| 1093 var openIntervals = []; | 1097 var openIntervals = []; |
| 1094 var stackTrace = []; | 1098 var stackTrace = []; |
| 1095 var maxDepth = 5; // minimum stack depth for the case when we see no act
ivity. | 1099 var maxDepth = 5; // minimum stack depth for the case when we see no act
ivity. |
| 1096 var depth = 0; | 1100 var depth = 0; |
| 1097 | 1101 |
| 1098 /** | 1102 /** |
| 1099 * @constructor | 1103 * @constructor |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1228 row.title = title; | 1232 row.title = title; |
| 1229 row.text = text; | 1233 row.text = text; |
| 1230 entryInfo.push(row); | 1234 entryInfo.push(row); |
| 1231 } | 1235 } |
| 1232 | 1236 |
| 1233 pushEntryInfoRow(WebInspector.UIString("Name"), node.functionName); | 1237 pushEntryInfoRow(WebInspector.UIString("Name"), node.functionName); |
| 1234 var selfTime = this._millisecondsToString(this._entrySelfTimes[entryInde
x]); | 1238 var selfTime = this._millisecondsToString(this._entrySelfTimes[entryInde
x]); |
| 1235 var totalTime = this._millisecondsToString(timelineData.entryTotalTimes[
entryIndex]); | 1239 var totalTime = this._millisecondsToString(timelineData.entryTotalTimes[
entryIndex]); |
| 1236 pushEntryInfoRow(WebInspector.UIString("Self time"), selfTime); | 1240 pushEntryInfoRow(WebInspector.UIString("Self time"), selfTime); |
| 1237 pushEntryInfoRow(WebInspector.UIString("Total time"), totalTime); | 1241 pushEntryInfoRow(WebInspector.UIString("Total time"), totalTime); |
| 1238 var target = this._cpuProfileView.profile.target(); | 1242 var target = this._target; |
| 1239 var text = WebInspector.Linkifier.liveLocationText(target, node.scriptId
, node.lineNumber, node.columnNumber); | 1243 var text = WebInspector.Linkifier.liveLocationText(target, node.scriptId
, node.lineNumber, node.columnNumber); |
| 1240 pushEntryInfoRow(WebInspector.UIString("URL"), text); | 1244 pushEntryInfoRow(WebInspector.UIString("URL"), text); |
| 1241 pushEntryInfoRow(WebInspector.UIString("Aggregated self time"), Number.s
econdsToString(node.selfTime / 1000, true)); | 1245 pushEntryInfoRow(WebInspector.UIString("Aggregated self time"), Number.s
econdsToString(node.selfTime / 1000, true)); |
| 1242 pushEntryInfoRow(WebInspector.UIString("Aggregated total time"), Number.
secondsToString(node.totalTime / 1000, true)); | 1246 pushEntryInfoRow(WebInspector.UIString("Aggregated total time"), Number.
secondsToString(node.totalTime / 1000, true)); |
| 1243 if (node.deoptReason && node.deoptReason !== "no reason") | 1247 if (node.deoptReason && node.deoptReason !== "no reason") |
| 1244 pushEntryInfoRow(WebInspector.UIString("Not optimized"), node.deoptR
eason); | 1248 pushEntryInfoRow(WebInspector.UIString("Not optimized"), node.deoptR
eason); |
| 1245 | 1249 |
| 1246 return entryInfo; | 1250 return entryInfo; |
| 1247 }, | 1251 }, |
| 1248 | 1252 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1338 | 1342 |
| 1339 /** | 1343 /** |
| 1340 * @param {number} entryIndex | 1344 * @param {number} entryIndex |
| 1341 * @return {!string} | 1345 * @return {!string} |
| 1342 */ | 1346 */ |
| 1343 textColor: function(entryIndex) | 1347 textColor: function(entryIndex) |
| 1344 { | 1348 { |
| 1345 return "#333"; | 1349 return "#333"; |
| 1346 } | 1350 } |
| 1347 } | 1351 } |
| OLD | NEW |