[pypy-svn] r70661 - in pypy/build/bot2/jsplot: . css js

fijal at codespeak.net fijal at codespeak.net
Sun Jan 17 20:50:05 CET 2010


Author: fijal
Date: Sun Jan 17 20:50:03 2010
New Revision: 70661

Added:
   pypy/build/bot2/jsplot/plotsummary.html
Modified:
   pypy/build/bot2/jsplot/css/main.css
   pypy/build/bot2/jsplot/js/plot.js
Log:
Add a small summary that displays small graphs


Modified: pypy/build/bot2/jsplot/css/main.css
==============================================================================
--- pypy/build/bot2/jsplot/css/main.css	(original)
+++ pypy/build/bot2/jsplot/css/main.css	Sun Jan 17 20:50:03 2010
@@ -3,7 +3,16 @@
     width: 600px;
     height: 300px;
 }
+.miniplot {
+    width: 200px;
+    height: 100px;
+}
 .caption {
     font-size: 14pt;
     font-family: Verdana;
 }
+.smallcaption {
+    font-size: 10pt;
+    font-family: Verdana;
+    text-align: center;
+}

Modified: pypy/build/bot2/jsplot/js/plot.js
==============================================================================
--- pypy/build/bot2/jsplot/js/plot.js	(original)
+++ pypy/build/bot2/jsplot/js/plot.js	Sun Jan 17 20:50:03 2010
@@ -9,18 +9,9 @@
     JSON_DIR_LIST = JSON_DIR_URL + "dir";
 }
 
-function plot_main(benchname, benchresults, cpython_results) {
-    $("#placeholder").append("<p class='caption'>" + benchname + "</p>");
-    $("#placeholder").append("<div class='plot'></div>");
-    var plotinput = [{
-        label: 'pypy-c-jit',
-        data : benchresults,
-    },
-    {
-        label: 'cpython',
-        data : cpython_results
-    }];
-    $.plot($("#placeholder").children(":last"), plotinput, {
+function common_attrs()
+{
+    return {
         'series': {
             'points': {'show': true},
             'lines' : {'show': true},
@@ -33,8 +24,41 @@
             'min': 0,
         },
         'legend' : {
-            'position' : 'sw'
+            'position': 'nw',
         }
-    });
+    }
+}
+
+function get_plot_input(benchresults, cpython_results)
+{
+    return [{
+        label: 'pypy-c-jit',
+        data : benchresults,
+    },
+    {
+        label: 'cpython',
+        data : cpython_results
+    }];
 }
 
+var MAX_PER_LINE = 4;
+
+function plot_miniature(benchname, benchresults, cpython_results)
+{
+    if ($("#placeholder").find("td").length % MAX_PER_LINE == 0) {
+        $("#placeholder").append("<tr></tr>");
+    }
+    $("#placeholder").find("tr:last").append("<td><p class='smallcaption'>" + benchname + "</p><div class='miniplot'></div></td>");
+    var elem = $("#placeholder").find("div:last");
+    var attrs = common_attrs();
+    attrs.xaxis.ticks = 0;
+    attrs.yaxis.ticks = 0;
+    $.plot(elem, [benchresults, cpython_results], attrs);
+}
+
+function plot_main(benchname, benchresults, cpython_results) {
+    $("#placeholder").append("<p class='caption'>" + benchname + "</p>");
+    $("#placeholder").append("<div class='plot'></div>");
+    var plotinput = get_plot_input(benchresults, cpython_results)
+    $.plot($("#placeholder").children(":last"), plotinput, common_attrs());
+}

Added: pypy/build/bot2/jsplot/plotsummary.html
==============================================================================
--- (empty file)
+++ pypy/build/bot2/jsplot/plotsummary.html	Sun Jan 17 20:50:03 2010
@@ -0,0 +1,23 @@
+
+<html>
+  <head>
+    <script src="js/underscore-min.js"></script>
+    <script src="js/jquery.min.js"></script>
+    <script src="js/jquery.flot.js"></script>
+    <script src="js/collect.js"></script>
+    <script src="js/plot.js"></script>
+    <script>    
+      $(document).ready(function() {
+        collect_data(plot_miniature, JSON_DIR_LIST, JSON_DIR_URL, true);
+      });
+    </script>
+    <link rel="stylesheet" href="css/main.css" type="text/css"/>
+  </head>
+  <body>
+    <h1>Benchmarks</h1>
+    <table id="placeholder">
+      <tr>
+      </tr>
+    </table>
+  </body>
+</html>



More information about the Pypy-commit mailing list