Modified: trunk/Tools/ChangeLog (91414 => 91415)
--- trunk/Tools/ChangeLog 2011-07-20 23:13:32 UTC (rev 91414)
+++ trunk/Tools/ChangeLog 2011-07-20 23:15:26 UTC (rev 91415)
@@ -1,3 +1,20 @@
+2011-07-20 Ojan Vafai <[email protected]>
+
+ show a list of average test times in the treemap
+ https://bugs.webkit.org/show_bug.cgi?id=64899
+
+ Reviewed by Adam Roben.
+
+ For now, you click a link and it replaces the treemap
+ with a reverse sorted list of directories based on
+ average test runtime within that directory.
+
+ To cut some of the noise, we don't show directories
+ that only have one test in them or where the average
+ runtime is less than 100ms.
+
+ * TestResultServer/static-dashboards/treemap.html:
+
2011-07-20 Eric Seidel <[email protected]>
Teach build.webkit.org how to identify leaks in NRWT output
Modified: trunk/Tools/TestResultServer/static-dashboards/treemap.html (91414 => 91415)
--- trunk/Tools/TestResultServer/static-dashboards/treemap.html 2011-07-20 23:13:32 UTC (rev 91414)
+++ trunk/Tools/TestResultServer/static-dashboards/treemap.html 2011-07-20 23:15:26 UTC (rev 91415)
@@ -45,6 +45,14 @@
left: 0;
}
+td:first-child {
+ text-align: left;
+}
+
+td {
+ text-align: right;
+}
+
#map {
display: -moz-box;
display: -webkit-box;
@@ -104,7 +112,7 @@
<script src=''></script>
<div id='header-container'></div>
-<p>Click on a box to zoom in. Click on the outermost box to zoom out.</p>
+<p>Click on a box to zoom in. Click on the outermost box to zoom out. <a href="" _onclick_="showAverages();return false;">Show averages</a></p>
<div id='map'></div>
<script>
@@ -115,9 +123,9 @@
function humanReadableTime(milliseconds)
{
if (milliseconds < 1000)
- return milliseconds + 'ms';
+ return Math.floor(milliseconds) + 'ms';
else if (milliseconds < 60000)
- return Math.floor(milliseconds / 1000).toPrecision(2) + 's';
+ return (milliseconds / 1000).toPrecision(2) + 's';
var minutes = Math.floor(milliseconds / 60000);
var seconds = Math.floor((milliseconds - minutes * 60000) / 1000);
@@ -129,7 +137,7 @@
// "name": (name of this node),
// "children": [ (child nodes, in the same format as this) ] }
// childCount is added just to be includes in the node's name
-function convertToWebTreemapFormat(treename, tree)
+function convertToWebTreemapFormat(treename, tree, path)
{
var total = 0;
var childCount = 0;
@@ -146,7 +154,8 @@
total += time;
childCount++;
} else {
- var subtree = convertToWebTreemapFormat(name, treeNode);
+ var newPath = path ? path + '/' + name : name;
+ var subtree = convertToWebTreemapFormat(name, treeNode, newPath);
children.push(subtree);
total += subtree["data"]["$area"];
childCount += subtree["childCount"];
@@ -163,10 +172,59 @@
"data": {"$area": total},
"name": treename + " (" + humanReadableTime(total) + " - " + childCount + " tests)",
"children": children,
- "childCount": childCount
+ "childCount": childCount,
+ "path": path
};
}
+function listOfAllNonLeafNodes(tree, list)
+{
+ if (!tree.children)
+ return;
+
+ if (!list)
+ list = [];
+ list.push(tree);
+
+ tree.children.forEach(function(child) {
+ listOfAllNonLeafNodes(child, list);
+ });
+ return list;
+}
+
+function reverseSortByAverage(list)
+{
+ list.sort(function(a, b) {
+ var avgA = a.data['$area'] / a.childCount;
+ var avgB = b.data['$area'] / b.childCount;
+ return avgB - avgA;
+ });
+}
+
+function showAverages()
+{
+ if (!document.getElementById('map'))
+ return;
+
+ var table = document.createElement('table');
+ table.innerHTML = '<th>directory</th><th># tests</th><th>avg time / test</th>';
+
+ var allNodes = listOfAllNonLeafNodes(g_webTree);
+ reverseSortByAverage(allNodes);
+ allNodes.forEach(function(node) {
+ var average = node.data['$area'] / node.childCount;
+ if (average > 100 && node.childCount != 1) {
+ var tr = document.createElement('tr');
+ tr.innerHTML = '<td></td><td>' + node.childCount + '</td><td>' + humanReadableTime(average) + '</td>';
+ tr.querySelector('td').innerText = node.path;
+ table.appendChild(tr);
+ }
+ });
+
+ var map = document.getElementById('map');
+ map.parentNode.replaceChild(table, map);
+}
+
var g_resultsByBuilder = {};
function ADD_RESULTS(data)
@@ -180,6 +238,7 @@
}
var g_isGeneratingPage = false;
+var g_webTree;
function generatePage()
{
@@ -191,8 +250,8 @@
g_isGeneratingPage = true;
var rawTree = g_resultsByBuilder[g_currentState.builder];
- var webtree = convertToWebTreemapFormat('LayoutTests', rawTree);
- appendTreemap($('map'), webtree);
+ g_webTree = convertToWebTreemapFormat('LayoutTests', rawTree);
+ appendTreemap($('map'), g_webTree);
if (g_currentState.treemapfocus)
focusPath(webtree, g_currentState.treemapfocus)