Changeset 58242 in webkit
- Timestamp:
- Apr 26, 2010 2:35:00 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r58236 r58242 1 2010-04-23 Ilya Tikhonovsky <loislo@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 WebInspector: Aggregated stats of time spent in children records should be visible 6 in the popup panel of parent record. Crash in pushGCEventRecord also was fixed. 7 https://bugs.webkit.org/show_bug.cgi?id=37820 8 9 * English.lproj/localizedStrings.js: 10 * inspector/InspectorTimelineAgent.cpp: 11 (WebCore::InspectorTimelineAgent::pushGCEventRecords): 12 * inspector/front-end/TimelinePanel.js: 13 (WebInspector.TimelinePanel.prototype._innerAddRecordToTimeline): 14 (WebInspector.TimelinePanel.prototype._createRootRecord): 15 (WebInspector.TimelinePanel.prototype._showPopover): 16 (WebInspector.TimelineCalculator.prototype.computeBarGraphPercentages): 17 (WebInspector.TimelineCalculator.prototype.computeBarGraphWindowPosition): 18 (WebInspector.TimelineRecordGraphRow): 19 (WebInspector.TimelineRecordGraphRow.prototype.update): 20 (WebInspector.TimelinePanel.FormattedRecord): 21 (WebInspector.TimelinePanel.FormattedRecord.prototype._generateAggregatedInfo): 22 (WebInspector.TimelinePanel.FormattedRecord.prototype._generatePopupContent): 23 (WebInspector.TimelinePanel.FormattedRecord.prototype._getRecordDetails): 24 (WebInspector.TimelinePanel.FormattedRecord.prototype._calculateAggregatedStats): 25 * inspector/front-end/inspector.css: 26 (.timeline-graph-bar.with-children): 27 (.timeline-graph-bar.cpu): 28 (.timeline-aggregated-category): 29 (.timeline-loading): 30 (.timeline-scripting): 31 (.timeline-rendering): 32 (.popover .timeline-aggregated-category.timeline-loading): 33 (.timeline-details-title): 34 1 35 2010-04-25 Kent Tamura <tkent@chromium.org> 2 36 -
trunk/WebCore/inspector/InspectorTimelineAgent.cpp
r57387 r58242 57 57 void InspectorTimelineAgent::pushGCEventRecords() 58 58 { 59 for (GCEvents::iterator i = m_gcEvents.begin(); i != m_gcEvents.end(); ++i) { 59 if (!m_gcEvents.size()) 60 return; 61 62 GCEvents events = m_gcEvents; 63 m_gcEvents.clear(); 64 for (GCEvents::iterator i = events.begin(); i != events.end(); ++i) { 60 65 ScriptObject record = TimelineRecordFactory::createGenericRecord(m_frontend, i->startTime); 61 66 record.set("data", TimelineRecordFactory::createGCEventData(m_frontend, i->collectedBytes)); … … 63 68 addRecordToTimeline(record, GCEventTimelineRecordType); 64 69 } 65 m_gcEvents.clear();66 70 } 67 71 -
trunk/WebCore/inspector/front-end/TimelinePanel.js
r58087 r58242 282 282 { 283 283 var connectedToOldRecord = false; 284 if (parentRecord === this._rootRecord) { 284 var recordTypes = WebInspector.TimelineAgent.RecordType; 285 if (record.type === recordTypes.MarkDOMContentEventType || record.type === recordTypes.MarkLoadEventType) 286 parentRecord = null; // No bar entry for load events. 287 else if (parentRecord === this._rootRecord) { 285 288 var newParentRecord = this._findParentRecord(record); 286 289 if (newParentRecord) { … … 289 292 } 290 293 } 291 var recordTypes = WebInspector.TimelineAgent.RecordType;292 294 293 295 var formattedRecord = new WebInspector.TimelinePanel.FormattedRecord(record, parentRecord, this._recordStyles, this._sendRequestRecords, this._timerRecords); 294 296 295 297 if (record.type === recordTypes.MarkDOMContentEventType || record.type === recordTypes.MarkLoadEventType) { 296 // No bar entry for load events.297 298 this._markTimelineRecords.push(formattedRecord); 298 299 return; … … 300 301 301 302 ++this._rootRecord._allRecordsCount; 302 303 if (parentRecord === this._rootRecord) 304 formattedRecord.collapsed = true; 303 formattedRecord.collapsed = (parentRecord === this._rootRecord); 305 304 306 305 for (var i = 0; record.children && i < record.children.length; ++i) 307 306 this._innerAddRecordToTimeline(record.children[i], formattedRecord); 308 307 308 formattedRecord._calculateAggregatedStats(this.categories); 309 309 310 if (connectedToOldRecord) { 310 311 var record = formattedRecord; 311 while (record.parent && record.parent._lastChildEndTime < record._lastChildEndTime) { 312 record.parent._lastChildEndTime = record._lastChildEndTime; 313 record = record.parent; 314 } 315 } 312 do { 313 var parent = record.parent; 314 parent._cpuTime += formattedRecord._cpuTime; 315 if (parent._lastChildEndTime < record._lastChildEndTime) 316 parent._lastChildEndTime = record._lastChildEndTime; 317 for (var category in formattedRecord._aggregatedStats) 318 parent._aggregatedStats[category] += formattedRecord._aggregatedStats[category]; 319 record = parent; 320 } while (record.parent); 321 } else 322 if (parentRecord !== this._rootRecord) 323 parentRecord._selfTime -= formattedRecord.endTime - formattedRecord.startTime; 316 324 317 325 // Keep bar entry for mark timeline since nesting might be interesting to the user. … … 346 354 rootRecord._visibleRecordsCount = 0; 347 355 rootRecord._allRecordsCount = 0; 356 rootRecord._aggregatedStats = {}; 348 357 return rootRecord; 349 358 }, … … 553 562 { 554 563 var record = anchor.row._record; 555 var popover = new WebInspector.Popover(record._generatePopupContent(this._calculator ));564 var popover = new WebInspector.Popover(record._generatePopupContent(this._calculator, this.categories)); 556 565 popover.show(anchor); 557 566 return popover; … … 585 594 { 586 595 var start = (record.startTime - this.minimumBoundary) / this.boundarySpan * 100; 587 var end = (record. endTime - this.minimumBoundary) / this.boundarySpan * 100;596 var end = (record.startTime + record._selfTime - this.minimumBoundary) / this.boundarySpan * 100; 588 597 var endWithChildren = (record._lastChildEndTime - this.minimumBoundary) / this.boundarySpan * 100; 589 return {start: start, end: end, endWithChildren: endWithChildren}; 598 var cpuWidth = record._cpuTime / this.boundarySpan * 100; 599 return {start: start, end: end, endWithChildren: endWithChildren, cpuWidth: cpuWidth}; 590 600 }, 591 601 … … 599 609 var width = (percentages.end - percentages.start) / 100 * workingArea + minWidth; 600 610 var widthWithChildren = (percentages.endWithChildren - percentages.start) / 100 * workingArea; 611 var cpuWidth = percentages.cpuWidth / 100 * workingArea + minWidth; 601 612 if (percentages.endWithChildren > percentages.end) 602 613 widthWithChildren += borderWidth + minWidth; 603 return {left: left, width: width, widthWithChildren: widthWithChildren };614 return {left: left, width: width, widthWithChildren: widthWithChildren, cpuWidth: cpuWidth}; 604 615 }, 605 616 … … 706 717 this._barAreaElement.appendChild(this._barWithChildrenElement); 707 718 719 this._barCpuElement = document.createElement("div"); 720 this._barCpuElement.className = "timeline-graph-bar cpu" 721 this._barCpuElement.row = this; 722 this._barAreaElement.appendChild(this._barCpuElement); 723 708 724 this._barElement = document.createElement("div"); 709 725 this._barElement.className = "timeline-graph-bar"; … … 735 751 this._barElement.style.left = barPosition.left + expandOffset + "px"; 736 752 this._barElement.style.width = barPosition.width + "px"; 753 this._barCpuElement.style.left = barPosition.left + expandOffset + "px"; 754 this._barCpuElement.style.width = barPosition.cpuWidth + "px"; 737 755 738 756 if (record._visibleChildrenCount || record._invisibleChildrenCount) { … … 774 792 775 793 this.parent = parentRecord; 776 parentRecord.children.push(this); 794 if (parentRecord) 795 parentRecord.children.push(this); 777 796 this.category = style.category; 778 797 this.title = style.title; … … 782 801 this.type = record.type; 783 802 this.endTime = (typeof record.endTime !== "undefined") ? record.endTime / 1000 : this.startTime; 803 this._selfTime = this.endTime - this.startTime; 784 804 this._lastChildEndTime = this.endTime; 785 805 this.originalRecordForTests = record; … … 866 886 }, 867 887 868 _generatePopupContent: function(calculator) 888 _generateAggregatedInfo: function() 889 { 890 var cell = document.createElement("span"); 891 cell.className = "timeline-aggregated-info"; 892 for (var index in this._aggregatedStats) { 893 var label = document.createElement("div"); 894 label.className = "timeline-aggregated-category timeline-" + index; 895 cell.appendChild(label); 896 var text = document.createElement("span"); 897 text.textContent = Number.secondsToString(this._aggregatedStats[index] + 0.0001); 898 cell.appendChild(text); 899 } 900 return cell; 901 }, 902 903 _generatePopupContent: function(calculator, categories) 869 904 { 870 905 var recordContentTable = document.createElement("table"); … … 874 909 titleRow.appendChild(titleCell); 875 910 recordContentTable.appendChild(titleRow); 876 var text = Number.secondsToString(this.endTime - this.startTime) + " (@" + 911 912 if (this._children && this._children.length) { 913 recordContentTable.appendChild(this._createRow(WebInspector.UIString("Self Time"), Number.secondsToString(this._selfTime + 0.0001))); 914 recordContentTable.appendChild(this._createLinkRow(WebInspector.UIString("Aggregated Time"), this._generateAggregatedInfo())); 915 } 916 var text = Number.secondsToString(this._lastChildEndTime - this.startTime) + " (@" + 877 917 calculator.formatValue(this.startTime - calculator.minimumBoundary) + ")"; 878 918 recordContentTable.appendChild(this._createRow(WebInspector.UIString("Duration"), text)); … … 925 965 recordContentTable.appendChild(this._createLinkRow(WebInspector.UIString("Caller"), link)); 926 966 } 927 if (this.usedHeapSize) { 928 recordContentTable.appendChild(this._createRow(WebInspector.UIString("Used Heap Size"), Number.bytesToString(this.usedHeapSize))); 929 recordContentTable.appendChild(this._createRow(WebInspector.UIString("Total Heap Size"), Number.bytesToString(this.totalHeapSize))); 930 } 967 if (this.usedHeapSize) 968 recordContentTable.appendChild(this._createRow(WebInspector.UIString("Used Heap Size"), WebInspector.UIString("%s of %s", Number.bytesToString(this.usedHeapSize), Number.bytesToString(this.totalHeapSize)))); 969 931 970 return recordContentTable; 932 971 }, … … 960 999 return ""; 961 1000 } 1001 }, 1002 1003 _calculateAggregatedStats: function(categories) 1004 { 1005 this._aggregatedStats = {}; 1006 for (var category in categories) 1007 this._aggregatedStats[category] = 0; 1008 this._cpuTime = this._selfTime; 1009 1010 if (this._children) { 1011 for (var index = this._children.length; index; --index) { 1012 var child = this._children[index - 1]; 1013 this._aggregatedStats[child.category.name] += child._selfTime; 1014 for (var category in categories) 1015 this._aggregatedStats[category] += child._aggregatedStats[category]; 1016 } 1017 for (var category in this._aggregatedStats) 1018 this._cpuTime += this._aggregatedStats[category]; 1019 } 962 1020 } 963 1021 } 964 -
trunk/WebCore/inspector/front-end/inspector.css
r57280 r58242 3606 3606 3607 3607 .timeline-graph-bar.with-children { 3608 opacity: 0.3; 3608 opacity: 0.2; 3609 } 3610 3611 .timeline-graph-bar.cpu { 3612 opacity: 0.6; 3609 3613 } 3610 3614 … … 3623 3627 .timeline-category-rendering .timeline-graph-bar { 3624 3628 -webkit-border-image: url(Images/timelineBarPurple.png) 4 4 5 4; 3629 } 3630 3631 .timeline-aggregated-category { 3632 display: inline-block; 3633 height: 11px; 3634 margin-right: 2px; 3635 margin-left: 6px; 3636 position: relative; 3637 top: 2px; 3638 width: 10px; 3639 } 3640 3641 .timeline-loading { 3642 -webkit-border-image: url(Images/timelineBarBlue.png) 4 4 5 4; 3643 } 3644 3645 .timeline-scripting { 3646 -webkit-border-image: url(Images/timelineBarOrange.png) 4 4 5 4; 3647 } 3648 3649 .timeline-rendering { 3650 -webkit-border-image: url(Images/timelineBarPurple.png) 4 4 5 4; 3651 } 3652 3653 .popover .timeline-aggregated-category.timeline-loading { 3654 margin-left: 0px; 3625 3655 } 3626 3656 … … 3652 3682 3653 3683 .timeline-details-title { 3684 border-bottom: 1px solid #B8B8B8; 3685 font-size: 11px; 3654 3686 font-weight: bold; 3687 padding-bottom: 5px; 3688 padding-top: 0px; 3655 3689 white-space: nowrap; 3656 3690 }
Note: See TracChangeset
for help on using the changeset viewer.