Changeset 64144 in webkit
- Timestamp:
- Jul 27, 2010 11:32:43 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r64142 r64144 1 2010-07-27 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Joseph Pecoraro. 4 5 Web Inspector: render network timing as gant chart in popover. 6 7 https://bugs.webkit.org/show_bug.cgi?id=43051 8 9 * inspector/InspectorResource.cpp: 10 (WebCore::InspectorResource::buildObjectForTiming): 11 * inspector/front-end/ResourcesPanel.js: 12 (WebInspector.ResourcesPanel.prototype._showPopover): 13 * inspector/front-end/inspector.css: 14 (.resource-timing-row): 15 (.resource-timing-bar): 16 (.resource-timing-bar-title): 17 * inspector/front-end/utilities.js: 18 1 19 2010-07-27 Victor Wang <victorw@chromium.org> 2 20 -
trunk/WebCore/inspector/InspectorResource.cpp
r64142 r64144 395 395 ScriptObject jsonObject = frontend->newScriptObject(); 396 396 jsonObject.set("requestTime", timing->requestTime); 397 jsonObject.set("proxyDuration", timing->proxyStart == -1 ? -1 : (timing->proxyEnd - timing->proxyStart) / 1000.0); 398 jsonObject.set("dnsDuration", timing->dnsStart == -1 ? -1 : (timing->dnsEnd - timing->dnsStart) / 1000.0); 399 jsonObject.set("connectDuration", timing->connectStart == -1 ? -1 : (timing->connectEnd - timing->connectStart) / 1000.0); 400 jsonObject.set("sslDuration", timing->sslStart == -1 ? -1 : (timing->sslEnd - timing->sslStart) / 1000.0); 401 jsonObject.set("sendDuration", (timing->sendEnd - timing->sendStart) / 1000.0); 402 jsonObject.set("waitDuration", (timing->receiveHeadersEnd - timing->sendEnd) / 1000.0); 397 jsonObject.set("proxyStart", timing->proxyStart); 398 jsonObject.set("proxyEnd", timing->proxyEnd); 399 jsonObject.set("dnsStart", timing->dnsStart); 400 jsonObject.set("dnsEnd", timing->dnsEnd); 401 jsonObject.set("connectStart", timing->connectStart); 402 jsonObject.set("connectEnd", timing->connectEnd); 403 jsonObject.set("sslStart", timing->sslStart); 404 jsonObject.set("sslEnd", timing->sslEnd); 405 jsonObject.set("sendStart", timing->sendStart); 406 jsonObject.set("sendEnd", timing->sendEnd); 407 jsonObject.set("receiveHeadersEnd", timing->receiveHeadersEnd); 403 408 return jsonObject; 404 409 } -
trunk/WebCore/inspector/front-end/ResourcesPanel.js
r64037 r64144 793 793 var tableElement = document.createElement("table"); 794 794 var resource = anchor.parentElement.resource; 795 var data = []; 796 797 if (resource.timing.proxyDuration !== -1) { 798 data.push(WebInspector.UIString("Proxy")); 799 data.push(Number.secondsToString(resource.timing.proxyDuration)); 800 } 801 802 if (resource.timing.dnsDuration !== -1) { 803 data.push(WebInspector.UIString("DNS Lookup")); 804 data.push(Number.secondsToString(resource.timing.dnsDuration)); 805 } 806 807 if (resource.timing.connectDuration !== -1) { 808 if (resource.connectionReused) { 809 data.push(WebInspector.UIString("Blocking")); 810 data.push(Number.secondsToString(resource.timing.connectDuration)); 811 } else { 812 data.push(WebInspector.UIString("Connecting")); 795 var rows = []; 796 797 function addRow(title, start, end, color) 798 { 799 var row = {}; 800 row.title = title; 801 row.start = start; 802 row.end = end; 803 rows.push(row); 804 } 805 806 if (resource.timing.proxyStart !== -1) 807 addRow(WebInspector.UIString("Proxy"), resource.timing.proxyStart, resource.timing.proxyEnd); 808 809 if (resource.timing.dnsStart !== -1) { 810 addRow(WebInspector.UIString("DNS Lookup"), resource.timing.dnsStart, resource.timing.dnsEnd); 811 } 812 813 if (resource.timing.connectStart !== -1) { 814 if (resource.connectionReused) 815 addRow(WebInspector.UIString("Blocking"), resource.timing.connectStart, resource.timing.connectEnd); 816 else { 817 var connectStart = resource.timing.connectStart; 813 818 // Connection includes DNS, subtract it here. 814 var connectDuration = resource.timing.connectDuration; 815 if (resource.timing.dnsDuration !== -1) 816 connectDuration -= resource.timing.dnsDuration; 817 data.push(Number.secondsToString(connectDuration)); 819 if (resource.timing.dnsStart !== -1) 820 connectStart += resource.timing.dnsEnd - resource.timing.dnsStart; 821 addRow(WebInspector.UIString("Connecting"), connectStart, resource.timing.connectEnd); 818 822 } 819 823 } 820 824 821 if (resource.timing.sslDuration !== -1) { 822 data.push(WebInspector.UIString("SSL")); 823 data.push(Number.secondsToString(resource.timing.sslDuration)); 824 } 825 826 data.push(WebInspector.UIString("Sending")); 827 data.push(Number.secondsToString(resource.timing.sendDuration)); 828 829 data.push(WebInspector.UIString("Waiting")); 830 // Waiting includes SSL, subtract it here. 831 var waitDuration = resource.timing.waitDuration; 832 if (resource.timing.sslDuration !== -1) 833 waitDuration -= resource.timing.sslDuration; 834 data.push(Number.secondsToString(waitDuration)); 835 836 data.push(WebInspector.UIString("Receiving")); 837 data.push(Number.secondsToString(resource.endTime - resource.responseReceivedTime)); 838 839 for (var i = 0; i < data.length; i += 2) { 825 if (resource.timing.sslStart !== -1) 826 addRow(WebInspector.UIString("SSL"), resource.timing.sslStart, resource.timing.sslEnd); 827 828 var sendStart = resource.timing.sendStart; 829 if (resource.timing.sslStart !== -1) 830 sendStart += resource.timing.sslEnd - resource.timing.sslStart; 831 832 addRow(WebInspector.UIString("Sending"), resource.timing.sendStart, resource.timing.sendEnd); 833 addRow(WebInspector.UIString("Waiting"), resource.timing.sendEnd, resource.timing.receiveHeadersEnd); 834 addRow(WebInspector.UIString("Receiving"), (resource.responseReceivedTime - resource.timing.requestTime) * 1000, (resource.endTime - resource.timing.requestTime) * 1000); 835 836 const chartWidth = 200; 837 var total = (resource.endTime - resource.timing.requestTime) * 1000; 838 var scale = chartWidth / total; 839 840 for (var i = 0; i < rows.length; ++i) { 840 841 var tr = document.createElement("tr"); 841 842 tableElement.appendChild(tr); 842 843 843 844 var td = document.createElement("td"); 844 td.textContent = data[i];845 td.textContent = rows[i].title; 845 846 tr.appendChild(td); 846 847 847 848 td = document.createElement("td"); 848 td.align = "right"; 849 td.textContent = data[i + 1]; 849 td.width = chartWidth + "px"; 850 851 var row = document.createElement("div"); 852 row.className = "resource-timing-row"; 853 td.appendChild(row); 854 855 var bar = document.createElement("span"); 856 bar.className = "resource-timing-bar"; 857 bar.style.left = scale * rows[i].start + "px"; 858 bar.style.right = scale * (total - rows[i].end) + "px"; 859 bar.style.backgroundColor = rows[i].color; 860 bar.textContent = "\u200B"; // Important for 0-time items to have 0 width. 861 row.appendChild(bar); 862 863 var title = document.createElement("span"); 864 title.className = "resource-timing-bar-title"; 865 if (i >= rows.length - 2) 866 title.style.right = (scale * (total - rows[i].end) + 3) + "px"; 867 else 868 title.style.left = (scale * rows[i].start + 3) + "px"; 869 title.textContent = Number.millisToString(rows[i].end - rows[i].start); 870 row.appendChild(title); 871 850 872 tr.appendChild(td); 851 873 } -
trunk/WebCore/inspector/front-end/inspector.css
r64142 r64144 978 978 } 979 979 980 .resource-timing-row { 981 position: relative; 982 height: 12px; 983 } 984 985 .resource-timing-bar { 986 position: absolute; 987 background-color: red; 988 border-left: 1px solid red; 989 opacity: 0.4; 990 } 991 992 .resource-timing-bar-title { 993 position: absolute; 994 } 995 980 996 #elements-content { 981 997 display: block; -
trunk/WebCore/inspector/front-end/utilities.js
r63663 r64144 640 640 } 641 641 642 Number.millisToString = function(ms, formatterFunction, higherResolution) 643 { 644 return Number.secondsToString(ms / 1000, formatterFunction, higherResolution); 645 } 646 642 647 Number.secondsToString = function(seconds, formatterFunction, higherResolution) 643 648 {
Note: See TracChangeset
for help on using the changeset viewer.