diff options
Diffstat (limited to 'Tools/BuildSlaveSupport/build.webkit.org-config/public_html')
9 files changed, 768 insertions, 0 deletions
diff --git a/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/LeaksLoader.js b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/LeaksLoader.js new file mode 100644 index 0000000..e559e73 --- /dev/null +++ b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/LeaksLoader.js @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +function LeaksLoader(didCountLeaksFilesCallback, didLoadLeaksFileCallback) { + this._didCountLeaksFilesCallback = didCountLeaksFilesCallback; + this._didLoadLeaksFileCallback = didLoadLeaksFileCallback; +} + +LeaksLoader.prototype = { + start: function(url) { + if (/\.txt$/.test(url)) + this._loadLeaksFiles([url]); + else + this._loadLeaksFromResultsPage(url); + }, + + _loadLeaksFiles: function(urls) { + this._didCountLeaksFilesCallback(urls.length); + + var self = this; + var pendingURLs = urls.length; + urls.forEach(function(url) { + getResource(url, function(xhr) { + self._didLoadLeaksFileCallback(xhr.responseText); + }); + }); + }, + + _loadLeaksFromResultsPage: function(url) { + var self = this; + getResource(url, function(xhr) { + var root = document.createElement("html"); + root.innerHTML = xhr.responseText; + + // Strip off everything after the last /. + var baseURL = url.substring(0, url.lastIndexOf("/") + 1); + + var urls = Array.prototype.map.call(root.querySelectorAll("tr.file > td > a[href$='-leaks.txt']"), function(link) { return baseURL + link.getAttribute("href"); }); + + self._loadLeaksFiles(urls); + }); + }, +}; diff --git a/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/LeaksParser.js b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/LeaksParser.js new file mode 100644 index 0000000..bcd3800 --- /dev/null +++ b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/LeaksParser.js @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +function LeaksParser(didParseLeaksFileCallback) { + this._didParseLeaksFileCallback = didParseLeaksFileCallback; + this._worker = new Worker("LeaksParserWorker.js"); + + var self = this; + this._worker.onmessage = function(e) { + self._didParseLeaksFileCallback(e.data); + }; +} + +LeaksParser.prototype = { + addLeaksFile: function(leaksText) { + this._worker.postMessage(leaksText); + }, +}; diff --git a/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/LeaksParserWorker.js b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/LeaksParserWorker.js new file mode 100644 index 0000000..c425b15 --- /dev/null +++ b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/LeaksParserWorker.js @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +function LeaksParserWorker() { + this.profile = this._createNode("top level"); +} + +LeaksParserWorker.prototype = { + addLeaksFile: function(leaksText) { + this._incorporateLeaks(this._parseLeaks(leaksText)); + }, + + _parseLeaks: function(text) { + var leaks = []; + var currentSize = 0; + text.split("\n").forEach(function(line) { + var match = /^Leak:.*\ssize=(\d+)\s/.exec(line); + if (match) { + currentSize = parseInt(match[1], 10); + return; + } + if (!/^\s+Call stack:/.test(line)) + return; + + // The first frame is not really a frame at all ("Call stack: thread 0xNNNNN:"), so we omit it. + leaks.push({ size: currentSize, stack: line.split(" | ").slice(1).map(function(str) { return str.trim(); }) }); + currentSize = 0; + }); + return leaks; + }, + + _createNode: function(functionName) { + return { + functionName: functionName, + selfTime: 0, + totalTime: 0, + averageTime: 0, + numberOfCalls: 0, + children: [], + childrenByName: {}, + callUID: functionName, + }; + }, + + // This function creates a fake "profile" from a set of leak stacks. "selfTime" is the number of + // stacks in which this function was at the top (in theory, only functions like malloc should have a + // non-zero selfTime). "totalTime" is the number of stacks which contain this function (and thus is + // the number of leaks that occurred in or beneath this function). + // FIXME: This is expensive! Can we parallelize it? + _incorporateLeaks: function(leaks) { + var self = this; + leaks.forEach(function(leak) { + leak.stack.reduce(function(node, frame, index, array) { + var childNode; + if (frame in node.childrenByName) + childNode = node.childrenByName[frame]; + else { + childNode = self._createNode(frame); + childNode.head = self.profile; + node.childrenByName[frame] = childNode; + node.children.push(childNode); + } + if (index === array.length - 1) + childNode.selfTime += leak.size; + childNode.totalTime += leak.size; + ++childNode.numberOfCalls; + return childNode; + }, self.profile); + }); + self.profile.totalTime = self.profile.children.reduce(function(sum, child) { return sum + child.totalTime; }, 0); + }, +}; + +var parser = new LeaksParserWorker(); + +onmessage = function(e) { + parser.addLeaksFile(e.data); + postMessage(parser.profile); +} diff --git a/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/LeaksViewer.css b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/LeaksViewer.css new file mode 100644 index 0000000..76d71a8 --- /dev/null +++ b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/LeaksViewer.css @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#url-prompt-container { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + background-color: rgba(0, 0, 0, 0.5); + z-index: 50000; +} + +#url-prompt { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + width: 400px; + height: 300px; + margin: auto; + background-color: white; + -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.8); + padding: 50px 0; + text-align: center; +} + +#loading-indicator { + position: absolute; + right: 20px; + width: 150px; + margin-top: 5px; +} + +#spinner { + float: left; + margin-top: -1px; +} + +#loading-indicator-label { + margin-left: 5px; +} + +#recent-builds-loading-indicator { + color: gray; +} + +#recent-builds-list { + list-style: none; + margin: 0; + padding: 0; +} + +/* Inspector style overrides */ + +.percent-time-status-bar-item { + /* We always show leak counts as real values, not percentages, so this button isn't useful. */ + display: none !important; +} + +.data-grid .data-container { + overflow-x: visible; + overflow-y: auto; +} + +.data-grid td > div, .data-grid th > div { + overflow: visible; +} diff --git a/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/LeaksViewer.js b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/LeaksViewer.js new file mode 100644 index 0000000..bd83f1a --- /dev/null +++ b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/LeaksViewer.js @@ -0,0 +1,202 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +var LeaksViewer = { + loaded: function() { + this._loader = new LeaksLoader(this._didCountLeaksFiles.bind(this), this._didLoadLeaksFile.bind(this)); + this._parser = new LeaksParser(this._didParseLeaksFile.bind(this)); + + this._loadingIndicator = document.getElementById("loading-indicator"); + this._loadingIndicatorLabel = document.getElementById("loading-indicator-label"); + + this._profileView = new WebInspector.CPUProfileView({}); + document.getElementById("main-panels").appendChild(this._profileView.element); + this._profileView.show(); + + // From WebInspector.Panel.prototype.show + var statusBarItems = this._profileView.statusBarItems; + if (statusBarItems) { + this._statusBarItemContainer = document.createElement("div"); + for (var i = 0; i < statusBarItems.length; ++i) + this._statusBarItemContainer.appendChild(statusBarItems[i]); + document.getElementById("main-status-bar").appendChild(this._statusBarItemContainer); + } + + var url; + var match = /url=([^&]+)/.exec(location.search); + if (match) + url = decodeURIComponent(match[1]); + + if (url) + this._loadLeaksFromURL(url) + else + this._displayURLPrompt(); + }, + + get filesLeftToParse() { + if (!('_filesLeftToParse' in this)) + this._filesLeftToParse = 0; + return this._filesLeftToParse; + }, + + set filesLeftToParse(x) { + if (this._filesLeftToParse === x) + return; + this._filesLeftToParse = x; + this._loadingStatusChanged(); + }, + + get loading() { + return this._isLoading; + }, + + set loading(x) { + if (this._isLoading === x) + return; + this._isLoading = x; + this._loadingStatusChanged(); + }, + + get url() { + return this._url; + }, + + set url(x) { + if (this._url === x) + return; + + this._url = x; + this._updateTitle(); + }, + + urlPromptButtonClicked: function(e) { + this._urlChosenFromPrompt(document.getElementById("url").value); + }, + + _didCountLeaksFiles: function(fileCount) { + this._fileCount = fileCount; + this.filesLeftToParse = fileCount; + }, + + _didLoadLeaksFile: function(leaksText) { + this._parser.addLeaksFile(leaksText); + }, + + _didLoadRecentBuilds: function(builds) { + this._recentBuilds = builds; + this._updateURLPrompt(); + }, + + _didParseLeaksFile: function(profile) { + if (--this.filesLeftToParse) + return; + ProfilerAgent.profileReady(profile); + this.loading = false; + }, + + _displayURLPrompt: function() { + document.getElementById("url-prompt-container").removeStyleClass("hidden"); + document.getElementById("url").focus(); + var loader = new RecentBuildsLoader(this._didLoadRecentBuilds.bind(this)); + loader.start("SnowLeopard Intel Leaks", this._numberOfRecentBuildsToLoad); + }, + + _loadLeaksFromURL: function(url) { + this.url = url; + this.loading = true; + + this._loader.start(this.url); + }, + + _loadingIndicatorText: function() { + var text = "Loading"; + if (this.filesLeftToParse) + text += " " + (this._fileCount - this.filesLeftToParse + 1) + "/" + this._fileCount + " files"; + text += "\u2026"; + return text; + }, + + _loadingStatusChanged: function() { + this._setLoadingIndicatorHidden(!this.loading); + this._updateLoadingIndicatorLabel(); + this._updateTitle(); + }, + + _numberOfRecentBuildsToLoad: 10, + + _setLoadingIndicatorHidden: function(hidden) { + if (hidden) + this._loadingIndicator.addStyleClass("hidden"); + else + this._loadingIndicator.removeStyleClass("hidden"); + }, + + _updateLoadingIndicatorLabel: function() { + this._loadingIndicatorLabel.innerText = this._loadingIndicatorText(); + }, + + _updateTitle: function() { + var title = "Leaks Viewer \u2014 "; + if (this.loading) + title += "(" + this._loadingIndicatorText() + ") "; + title += this.url; + document.title = title; + }, + + _updateURLPrompt: function() { + var recentBuildsContainer = document.getElementById("recent-builds-container"); + recentBuildsContainer.removeChildren(); + if (this._recentBuilds && this._recentBuilds.length) { + var list = document.createElement("ol"); + list.id = "recent-builds-list"; + + var self = this; + this._recentBuilds.forEach(function(build) { + var link = document.createElement("a"); + link.href = document.location.href + "?url=" + encodeURIComponent(build.url); + link.addEventListener("click", function(e) { + self._urlChosenFromPrompt(build.url); + e.preventDefault(); + }); + link.appendChild(document.createTextNode("r" + build.revision + ": " + build.leakCount + " leaks")); + var item = document.createElement("li"); + item.appendChild(link); + + list.appendChild(item); + }); + + recentBuildsContainer.appendChild(list); + } else + recentBuildsContainer.appendChild(document.createTextNode("No recent leaky builds found.")); + }, + + _urlChosenFromPrompt: function(url) { + this._loadLeaksFromURL(url); + document.getElementById("url-prompt-container").addStyleClass("hidden"); + }, + +}; + +addEventListener("load", LeaksViewer.loaded.bind(LeaksViewer)); diff --git a/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/RecentBuildsLoader.js b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/RecentBuildsLoader.js new file mode 100644 index 0000000..c15aef2 --- /dev/null +++ b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/RecentBuildsLoader.js @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +function RecentBuildsLoader(didLoadRecentBuildsCallback) { + this._didLoadRecentBuildsCallback = didLoadRecentBuildsCallback; +} + +RecentBuildsLoader.prototype = { + start: function(builderName, maximumNumberOfBuilds) { + var url = this._buildbotBaseURL + "/json/builders/" + builderName + "/builds/?"; + url += range(maximumNumberOfBuilds).map(function(n) { return "select=-" + (n + 1); }).join("&"); + var self = this; + getResource(url, function(xhr) { + var data = JSON.parse(xhr.responseText); + var builds = []; + Object.keys(data).forEach(function(buildNumber) { + var build = data[buildNumber]; + + var buildInfo = { + revision: build.sourceStamp.changes[0].rev, + leakCount: 0, + url: null, + }; + for (var stepIndex = 0; stepIndex < build.steps.length; ++stepIndex) { + var step = build.steps[stepIndex]; + if (step.name === "layout-test") { + if (!("text" in step)) + continue; + var strings = step.text; + for (var stringIndex = 0; stringIndex < strings.length; ++stringIndex) { + var match = /^(\d+) total leaks found!$/.exec(strings[stringIndex]); + if (!match) + continue; + buildInfo.leakCount = parseInt(match[1], 10); + break; + } + } else if (step.name === "MasterShellCommand") { + if (!("urls" in step)) + return; + if (!("view results" in step.urls)) + return; + buildInfo.url = self._buildbotBaseURL + step.urls["view results"] + "/"; + } + + if (buildInfo.leakCount && buildInfo.url) { + builds.push(buildInfo); + break; + } + } + }); + // Sort descending by revision. + builds.sort(function(a, b) { return b.revision - a.revision; }); + self._didLoadRecentBuildsCallback(builds); + }); + }, + + _buildbotBaseURL: "http://build.webkit.org/", +}; diff --git a/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/Utilities.js b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/Utilities.js new file mode 100644 index 0000000..c44848a --- /dev/null +++ b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/Utilities.js @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +function getResource(url, callback) { + var xhr = new XMLHttpRequest(); + xhr.onreadystatechange = function() { + // Allow a status of 0 for easier testing with local files. + if (this.readyState == 4 && (!this.status || this.status == 200)) + callback(this); + }; + xhr.open("GET", url); + xhr.send(); +} + +function range(n) { + var result = new Array(n); + for (var i = 0; i < n; ++i) + result[i] = i; + return result; +} diff --git a/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/WebInspectorShims.js b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/WebInspectorShims.js new file mode 100644 index 0000000..b948f12 --- /dev/null +++ b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/WebInspectorShims.js @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +// This file contains definitions that are needed to satisfy the Web Inspector JavaScript files we +// import. + +var WebInspector = { + UIString: function(string) { + return String.vsprintf(string, Array.prototype.slice.call(arguments, 1)); + }, +}; + +var Preferences = { + // Setting this to false causes the "Average" and "Calls" columns to be shown. + samplingCPUProfiler: false, +}; + +var ProfilerAgent = { + getProfile: function(typeId, uid, callback) { + this._callback = callback; + }, + + profileReady: function(head) { + this._callback({ head: head }); + }, +}; + +// This function makes any required changes to objects imported from the Web Inspector JavaScript +// files. +function monkeyPatchInspectorObjects() { + var originalGetter = WebInspector.ProfileDataGridNode.prototype.__lookupGetter__("data"); + WebInspector.ProfileDataGridNode.prototype.__defineGetter__("data", function() { + var data = originalGetter.call(this); + + // ProfileDataGridNode formats values as milliseconds, but we are instead measuring bytes. + if (!this.profileView.showSelfTimeAsPercent) + data.self = Number.bytesToString(this.selfTime); + if (!this.profileView.showTotalTimeAsPercent) + data.total = Number.bytesToString(this.totalTime); + if (!this.profileView.showAverageTimeAsPercent) + data.average = Number.bytesToString(this.averageTime); + + return data; + }); +} diff --git a/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/index.html b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/index.html new file mode 100644 index 0000000..3c185bc --- /dev/null +++ b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/index.html @@ -0,0 +1,80 @@ +<!-- +Copyright (C) 2011 Apple Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. +--> + +<!DOCTYPE html> +<html> +<head> + <title>Leaks Viewer</title> + <link rel=stylesheet href="http://svn.webkit.org/repository/webkit/trunk/Source/WebCore/inspector/front-end/inspector.css?p=80565"> + <link rel=stylesheet href=LeaksViewer.css> + + <script src=WebInspectorShims.js></script> + + <!-- The order here matches inspector.html. --> + <script src="http://svn.webkit.org/repository/webkit/!svn/bc/80565/trunk/Source/WebCore/inspector/front-end/utilities.js"></script> + <script src="http://svn.webkit.org/repository/webkit/!svn/bc/80565/trunk/Source/WebCore/inspector/front-end/treeoutline.js"></script> + <script src="http://svn.webkit.org/repository/webkit/!svn/bc/80565/trunk/Source/WebCore/inspector/front-end/Object.js"></script> + <script src="http://svn.webkit.org/repository/webkit/!svn/bc/80565/trunk/Source/WebCore/inspector/front-end/View.js"></script> + <script src="http://svn.webkit.org/repository/webkit/!svn/bc/80565/trunk/Source/WebCore/inspector/front-end/Panel.js"></script> + <script src="http://svn.webkit.org/repository/webkit/!svn/bc/80565/trunk/Source/WebCore/inspector/front-end/DataGrid.js"></script> + <script src="http://svn.webkit.org/repository/webkit/!svn/bc/80565/trunk/Source/WebCore/inspector/front-end/SidebarTreeElement.js"></script> + <script src="http://svn.webkit.org/repository/webkit/!svn/bc/80565/trunk/Source/WebCore/inspector/front-end/StatusBarButton.js"></script> + <script src="http://svn.webkit.org/repository/webkit/!svn/bc/80565/trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js"></script> + <script src="http://svn.webkit.org/repository/webkit/!svn/bc/80565/trunk/Source/WebCore/inspector/front-end/ProfileDataGridTree.js"></script> + <script src="http://svn.webkit.org/repository/webkit/!svn/bc/80565/trunk/Source/WebCore/inspector/front-end/BottomUpProfileDataGridTree.js"></script> + <script src="http://svn.webkit.org/repository/webkit/!svn/bc/80565/trunk/Source/WebCore/inspector/front-end/TopDownProfileDataGridTree.js"></script> + <script src="http://svn.webkit.org/repository/webkit/!svn/bc/80565/trunk/Source/WebCore/inspector/front-end/ProfileView.js"></script> + + <script> + // Now that all the Inspector files have loaded we can apply our monkey patches. + monkeyPatchInspectorObjects(); + </script> + + <script src=LeaksLoader.js></script> + <script src=LeaksParser.js></script> + <script src=LeaksViewer.js></script> + <script src=RecentBuildsLoader.js></script> + <script src=Utilities.js></script> +</head> +<body> + <div id=main-panels></div> + <div id=main-status-bar class=status-bar> + <div id=loading-indicator class=hidden> + <img id=spinner src=http://svn.webkit.org/repository/webkit/!svn/bc/80565/trunk/Source/WebCore/inspector/front-end/Images/spinner.gif> + <span id=loading-indicator-label>Loading…</span> + </div> + </div> + <div id=url-prompt-container class=hidden> + <div id=url-prompt> + <p>Enter the URL of a build results page or leaks file:</p> + <input id=url type=url><button onclick='LeaksViewer.urlPromptButtonClicked(event)'>Fetch leaks</button> + <p>Or choose a recent build:</p> + <div id=recent-builds-container> + <p id=recent-builds-loading-indicator>Loading builds…</p> + </div> + </div> + </div> +</body> +</html> |