[pypy-svn] r71588 - in codespeed: pyspeed/codespeed pyspeed/media/css pyspeed/templates tools

tobami at codespeak.net tobami at codespeak.net
Mon Mar 1 10:48:38 CET 2010


Author: tobami
Date: Mon Mar  1 10:48:36 2010
New Revision: 71588

Added:
   codespeed/tools/test_saveresults.py
Removed:
   codespeed/tools/test.py
Modified:
   codespeed/pyspeed/codespeed/views.py
   codespeed/pyspeed/media/css/main.css
   codespeed/pyspeed/templates/overview.html
   codespeed/pyspeed/templates/overview_table.html
   codespeed/pyspeed/templates/timeline.html
   codespeed/tools/import_from_json.py
   codespeed/tools/saveresults.py
Log:
fix IE. various changes

Modified: codespeed/pyspeed/codespeed/views.py
==============================================================================
--- codespeed/pyspeed/codespeed/views.py	(original)
+++ codespeed/pyspeed/codespeed/views.py	Mon Mar  1 10:48:36 2010
@@ -99,11 +99,11 @@
     revision = int(request.GET["revision"])
     lastrevisions = Revision.objects.filter(
         project=settings.PROJECT_NAME
-    ).filter(number__lte=revision).order_by('-number')[:11]
+    ).filter(number__lte=revision).order_by('-number')[:trendconfig+1]
     lastrevision = lastrevisions[0].number
     changerevision = lastrevisions[1].number    
     pastrevisions = lastrevisions[trendconfig-2:trendconfig+1]
-    
+    print pastrevisions
     result_list = Result.objects.filter(
         revision__number=lastrevision
     ).filter(
@@ -167,6 +167,7 @@
             relative =  c[0].value / result
         table_list.append({
             'benchmark': bench.name,
+            'bench_description': bench.description,
             'result': result,
             'change': change,
             'trend': trend,
@@ -182,6 +183,9 @@
     
     # Configuration of default parameters
     defaulthost = 1
+    defaultchangethres = 3
+    defaulttrendthres = 3
+    defaultcompthres = 0.2
     defaulttrend = 10
     trends = [5, 10, 20, 100]
     if data.has_key("trend"):

Modified: codespeed/pyspeed/media/css/main.css
==============================================================================
--- codespeed/pyspeed/media/css/main.css	(original)
+++ codespeed/pyspeed/media/css/main.css	Mon Mar  1 10:48:36 2010
@@ -23,8 +23,12 @@
 div#title h1 { line-height: 72px; margin: 0; font-style: italic; }
 div#wrapper { margin: 0; }
 
-div#nav ul { margin: 0; padding: 0; padding-left: 15.3em; }
-div#nav li { display: inline-block; }
+div#nav ul {
+    display: inline;
+    margin: 0; padding: 0; padding-left: 15.3em;
+    font-family: Verdana, sans-serif;
+}
+div#nav li { display: inline-block; list-style: none; }
 
 div#nav ul li a:link, div#nav ul li a:visited {
     display: block;
@@ -33,7 +37,6 @@
     text-align: center;
     background-color: #DADADA;
     color: #888888;
-/*     padding: 1em; */
     padding-top: 0.6em;
     padding-bottom: 0.3em;
     -moz-border-radius-topleft: 20px;
@@ -123,9 +126,15 @@
   margin: 0;
   padding: 0.2em;
 }
+.boxbody ul li ul { margin: 0; padding: 0; }
+.boxbody ul li ul h4 { margin: 0 0 0.4em; padding: 0; font-size: 1em; font-weight: normal;}
+.boxbody ul li ul li { margin-left: 1em; }
 .boxbody input[type="radio"] { margin-left: 0; }
 .boxbody input[type="checkbox"] { margin-left: 0; }
-
+.boxbody label { vertical-align: top; }
+.boxbody input[type="text"] {
+    margin-left: 0; margin-right: 2.5em; margin-bottom: 0.2em; float: right; width: 2em;
+}
 /* tables */
 table.tablesorter {
     width: 100%;
@@ -211,7 +220,7 @@
 
 table.tablesorter tbody tr td.status-red { background-color: #FF5640; }
 table.tablesorter tbody tr td.status-green { background-color: #9FD54D; }
-table.tablesorter tbody tr td.status-yellow { background-color: #FEE772; }
+/* table.tablesorter tbody tr td.status-yellow { background-color: #FEE772; } */
 table.tablesorter tbody tr.highlight td {
     background-color: #9DADC6 !important;
     cursor: pointer;
@@ -230,3 +239,5 @@
     clear: both;
     height: 0;
 }
+* html .clearfix             { zoom: 1; } /* IE6 */
+*:first-child+html .clearfix { zoom: 1; } /* IE7 */
\ No newline at end of file

Modified: codespeed/pyspeed/templates/overview.html
==============================================================================
--- codespeed/pyspeed/templates/overview.html	(original)
+++ codespeed/pyspeed/templates/overview.html	Mon Mar  1 10:48:36 2010
@@ -22,23 +22,43 @@
     window.location="/timeline/?" + ued_encode(conf);
   }
   
-  function updateTable() {
+  function isNumeric(textvalue) { 
+    if (textvalue.match(/^\d+$/) == null) 
+        return false; 
+    else 
+        return true; 
+  }
+
+  function getColorcode(change, theigh, tlow) {
+    var colorcode = "status-yellow";
+    if(change < tlow) { colorcode = "status-red"; }
+    else if(change > theigh) { colorcode = "status-green"; }
+    return colorcode;
+  }
+  
+  function colorTable() {
+    var changethres = {{ defaultchangethres }};
+    var trendthres = {{ defaulttrendthres }};
+    var compthres = {{ defaultcompthres }};
     $("#results > tbody > tr").each(function() {
       //Color change column
       var change = $(this).children("td:eq(2)").text().slice(0, -1);
-      var colorcode = "status-yellow";
-      if(change > 0.3) { colorcode = "status-red"; }
-      else if(change < -0.3) { colorcode = "status-green"; }
-      $(this).children("td:eq(2)").addClass(colorcode);
+      $(this).children("td:eq(2)").addClass(getColorcode(-change, changethres, -changethres));
+      //Color trend column
+      var trend = $(this).children("td:eq(3)").text().slice(0, -1);
+      $(this).children("td:eq(3)").addClass(getColorcode(-trend, trendthres, -trendthres));
       //Color comparison column
-      var comp = parseFloat($(this).children("td:eq(4)").text())
-      colorcode = "status-yellow";
-      if(comp < 0.8) { colorcode = "status-red"; }
-      else if(comp > 1.2) { colorcode = "status-green"; }
-      $(this).children("td:eq(4)").addClass(colorcode);
+      var comp = parseFloat($(this).children("td:eq(4)").text());
+      $(this).children("td:eq(4)").addClass(getColorcode(comp, 1+compthres, 1-compthres));
+    });
+  }
+  
+  function updateTable() {
+    colorTable();
+    $("#results > tbody > tr").each(function() {
       //Size plot bars
       var tdwidth = parseInt($("#results thead tr").find("th:eq(5)").css("width"));
-      var bar = transToLogBars(58, tdwidth, comp);
+      var bar = transToLogBars(58, tdwidth,  parseFloat($(this).children("td:eq(4)").text()));
       $(this).children("td:eq(5)").find("span").css("width", bar["width"]).css("margin-left", bar["margin"]);
       //Link rows to timelines
       $(this).click(function () { 
@@ -78,7 +98,6 @@
     $("input[name='interpreter']").change(refreshContent);
     $("input:radio[name=host]").filter('[value={{ defaulthost }}]').attr('checked', true);
     $("input[name='host']").change(refreshContent);
-
     refreshContent();
   });
 </script>

Modified: codespeed/pyspeed/templates/overview_table.html
==============================================================================
--- codespeed/pyspeed/templates/overview_table.html	(original)
+++ codespeed/pyspeed/templates/overview_table.html	Mon Mar  1 10:48:36 2010
@@ -6,7 +6,7 @@
 </thead>
 <tbody>
 {% for row in table_list %}  <tr>
-        <td class="text">{{ row.benchmark }}</td><td>{{ row.result|floatformat:3 }}</td><td>{{ row.change|floatformat:2 }}%</td><td>{{ row.trend }}{% ifnotequal row.trend "-" %}%{% endifnotequal %}</td><td>{{ row.relative|floatformat:2 }}</td><td class="bar"><span>-</span></td>
+        <td class="text"{% ifnotequal row.bench_description "" %} title="{{ row.bench_description }}"{% endifnotequal %}>{{ row.benchmark }}</td><td>{{ row.result|floatformat:3 }}</td><td>{{ row.change|floatformat:2 }}%</td><td>{{ row.trend }}{% ifnotequal row.trend "-" %}%{% endifnotequal %}</td><td>{{ row.relative|floatformat:2 }}</td><td class="bar"><span>-</span></td>
   </tr>{% endfor %}
 </tbody>
 </table>
\ No newline at end of file

Modified: codespeed/pyspeed/templates/timeline.html
==============================================================================
--- codespeed/pyspeed/templates/timeline.html	(original)
+++ codespeed/pyspeed/templates/timeline.html	Mon Mar  1 10:48:36 2010
@@ -1,7 +1,7 @@
 {% extends "base.html" %}
 {% block title %}PyPy Speed Center: Timeline{% endblock %}
 {% block script %}
-<!--[if IE]><script language="javascript" type="text/javascript" src="excanvas.js"></script><![endif]-->
+<!--[if IE]><script language="javascript" type="text/javascript" src="/media/js/jqplot/excanvas.min.js"></script><![endif]-->
 <link rel="stylesheet" type="text/css" href="/media/js/jqplot/jquery.jqplot.min.css" />
 <script language="javascript" type="text/javascript" src="/media/js/jqplot/jquery.jqplot.min.js"></script>
 <script type="text/javascript" src="/media/js/jqplot/jqplot.cursor.min.js"></script>

Modified: codespeed/tools/import_from_json.py
==============================================================================
--- codespeed/tools/import_from_json.py	(original)
+++ codespeed/tools/import_from_json.py	Mon Mar  1 10:48:36 2010
@@ -7,7 +7,8 @@
 RESULTS_URL = 'http://buildbot.pypy.org/bench_results/'
 SPEEDURL = 'http://speed.pypy.org/'
 SAVE_CPYTHON = False
-START_REV = 71480
+START_REV = 71557
+INTERP = "pypy-c-jit"
 
 def saveresult(data):
     params = urllib.urlencode(data)
@@ -60,7 +61,7 @@
     current_date = datetime.today()
     proj = 'pypy'
     revision = result['revision']
-    interpreter = "pypy-c-jit"
+    interpreter = INTERP
     int_options = "gc=hybrid"
     if result.has_key('branch'):
         if result['branch'] != 'trunk':

Modified: codespeed/tools/saveresults.py
==============================================================================
--- codespeed/tools/saveresults.py	(original)
+++ codespeed/tools/saveresults.py	Mon Mar  1 10:48:36 2010
@@ -1,28 +1,15 @@
 # -*- coding: utf-8 -*-
 import urllib, urllib2
 from datetime import datetime
-import logging, logging.handlers
-
-## SETUP LOGS ##
-LOG_FILENAME = 'pyspeed.log'
-logger = logging.getLogger('MyLogger')
-logger.setLevel(logging.DEBUG)
-# Add the log message handler to the logger
-handler = logging.handlers.RotatingFileHandler(
-    LOG_FILENAME, maxBytes=100000, backupCount=1)
-logger.addHandler(handler)
-################
 
 SPEEDURL = "http://speed.pypy.org/"
 HOST = "bigdog"
 
-def save(revision, results, options, branch, interpreter, int_options):
+def save(project, revision, results, options, branch, interpreter, int_options, testing=False):
+    testparams = []
     #Parse data
     data = {}
     current_date = datetime.today()
-    proj = "pypy"
-    #interpreter = "pypy-c-jit"
-    #int_options = "gc=hybrid"
     if branch != "" and branch != "trunk":
         interpreter = branch
         int_options = ""
@@ -37,11 +24,11 @@
         elif res_type == "ComparisonResult":
             value = results['avg_changed']
         else:
-            logger.critical("ERROR: result type unknown " + b[1])
+            print("ERROR: result type unknown " + b[1])
             return 1
         data = {
             'revision_number': revision,
-            'revision_project': proj,
+            'revision_project': project,
             'interpreter_name': interpreter,
             'interpreter_coptions': int_options,
             'benchmark_name': bench_name,
@@ -49,8 +36,10 @@
             'result_value': value,
             'result_date': current_date,
         }
-        send(data)
-    return 0
+        if testing: testparams.append(data)
+        else: send(data)
+    if testing: return testparams
+    else: return 0
     
 def send(data):
     #save results
@@ -59,7 +48,7 @@
     response = "None"
     info = str(datetime.today()) + ": Saving result for " + data['interpreter_name'] + " revision "
     info += str(data['revision_number']) + ", benchmark " + data['benchmark_name']
-    logger.info(info)
+    print(info)
     try:
         f = urllib2.urlopen(SPEEDURL + 'result/add/', params)
         response = f.read()
@@ -71,5 +60,5 @@
         elif hasattr(e, 'code'):
             response = '\n  The server couldn\'t fulfill the request\n'
             response += '  Error code: ' + str(e)
-        logger.critical("Server (%s) response: %s\n" % (SPEEDURL, response))
+        print("Server (%s) response: %s\n" % (SPEEDURL, response))
         return 1   

Added: codespeed/tools/test_saveresults.py
==============================================================================
--- (empty file)
+++ codespeed/tools/test_saveresults.py	Mon Mar  1 10:48:36 2010
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+import saveresults
+import unittest
+
+class testSaveresults(unittest.TestCase):
+    '''Tests Saveresults script for saving data to speed.pypy.org'''
+    fixture = [
+        ['ai', 'ComparisonResult', {'avg_base': 0.42950453758219992, 'timeline_link': None, 'avg_changed': 0.43322672843939997, 'min_base': 0.42631793022199999, 'delta_min': '1.0065x faster', 'delta_avg': '1.0087x slower', 'std_changed': 0.0094009621054567376, 'min_changed': 0.423564910889, 'delta_std': '2.7513x larger', 'std_base': 0.0034169249420902843, 't_msg': 'Not significant\n'}],
+        ['chaos', 'ComparisonResult', {'avg_base': 0.41804099082939999, 'timeline_link': None, 'avg_changed': 0.11744904518135998, 'min_base': 0.41700506210299998, 'delta_min': '9.0148x faster', 'delta_avg': '3.5593x faster', 'std_changed': 0.14350186143481433, 'min_changed': 0.046257972717299999, 'delta_std': '108.8162x larger', 'std_base': 0.0013187546718754512, 't_msg': 'Significant (t=4.683672, a=0.95)\n'}],
+        ['django', 'ComparisonResult', {'avg_base': 0.83651852607739996, 'timeline_link': None, 'avg_changed': 0.48571481704719999, 'min_base': 0.82990884780899998, 'delta_min': '1.7315x faster', 'delta_avg': '1.7222x faster', 'std_changed': 0.006386606999421761, 'min_changed': 0.47929787635799997, 'delta_std': '1.7229x smaller', 'std_base': 0.011003382690633789, 't_msg': 'Significant (t=61.655971, a=0.95)\n'}],
+        ['fannkuch', 'ComparisonResult', {'avg_base': 1.8561528205879998, 'timeline_link': None, 'avg_changed': 0.38401727676399999, 'min_base': 1.84801197052, 'delta_min': '5.0064x faster', 'delta_avg': '4.8335x faster', 'std_changed': 0.029594360755246251, 'min_changed': 0.36913013458299998, 'delta_std': '3.2353x larger', 'std_base': 0.0091472519207758066, 't_msg': 'Significant (t=106.269998, a=0.95)\n'}],
+        ['float', 'ComparisonResult', {'avg_base': 0.50523018836940004, 'timeline_link': None, 'avg_changed': 0.15490598678593998, 'min_base': 0.49911379814099999, 'delta_min': '6.2651x faster', 'delta_avg': '3.2615x faster', 'std_changed': 0.057739598339608837, 'min_changed': 0.079665899276699995, 'delta_std': '7.7119x larger', 'std_base': 0.007487037523761327, 't_msg': 'Significant (t=13.454285, a=0.95)\n'}], ['gcbench', 'SimpleComparisonResult', {'base_time': 27.236408948899999, 'changed_time': 5.3500790595999996, 'time_delta': '5.0908x faster'}],
+        ['html5lib', 'SimpleComparisonResult', {'base_time': 11.666918992999999, 'changed_time': 12.6703209877, 'time_delta': '1.0860x slower'}],
+        ['richards', 'ComparisonResult', {'avg_base': 0.29083266258220003, 'timeline_link': None, 'avg_changed': 0.029299402236939998, 'min_base': 0.29025602340700002, 'delta_min': '10.7327x faster', 'delta_avg': '9.9262x faster', 'std_changed': 0.0033452973342946888, 'min_changed': 0.027044057846099999, 'delta_std': '5.6668x larger', 'std_base': 0.00059033067516221327, 't_msg': 'Significant (t=172.154488, a=0.95)\n'}],
+        ['rietveld', 'ComparisonResult', {'avg_base': 0.46909418106079998, 'timeline_link': None, 'avg_changed': 1.312631273269, 'min_base': 0.46490097045899997, 'delta_min': '2.1137x slower', 'delta_avg': '2.7982x slower', 'std_changed': 0.44401595627955542, 'min_changed': 0.98267102241500004, 'delta_std': '76.0238x larger', 'std_base': 0.0058404831974135556, 't_msg': 'Significant (t=-4.247692, a=0.95)\n'}],
+        ['slowspitfire', 'ComparisonResult', {'avg_base': 0.66740002632140005, 'timeline_link': None, 'avg_changed': 1.6204295635219998, 'min_base': 0.65965509414699997, 'delta_min': '1.9126x slower', 'delta_avg': '2.4280x slower', 'std_changed': 0.27415559151786589, 'min_changed': 1.26167798042, 'delta_std': '20.1860x larger', 'std_base': 0.013581457669479846, 't_msg': 'Significant (t=-7.763579, a=0.95)\n'}],
+        ['spambayes', 'ComparisonResult', {'avg_base': 0.279049730301, 'timeline_link': None, 'avg_changed': 1.0178018569945999, 'min_base': 0.27623891830399999, 'delta_min': '3.3032x slower', 'delta_avg': '3.6474x slower', 'std_changed': 0.064953583956645466, 'min_changed': 0.91246294975300002, 'delta_std': '28.9417x larger', 'std_base': 0.0022442880892229711, 't_msg': 'Significant (t=-25.416839, a=0.95)\n'}],
+        ['spectral-norm', 'ComparisonResult', {'avg_base': 0.48315834999099999, 'timeline_link': None, 'avg_changed': 0.066225481033300004, 'min_base': 0.476922035217, 'delta_min': '8.0344x faster', 'delta_avg': '7.2957x faster', 'std_changed': 0.013425108838933627, 'min_changed': 0.059360027313200003, 'delta_std': '1.9393x larger', 'std_base': 0.0069225510731835901, 't_msg': 'Significant (t=61.721418, a=0.95)\n'}],
+        ['spitfire', 'ComparisonResult', {'avg_base': 7.1179999999999994, 'timeline_link': None, 'avg_changed': 7.2780000000000005, 'min_base': 7.04, 'delta_min': '1.0072x faster', 'delta_avg': '1.0225x slower', 'std_changed': 0.30507376157250898, 'min_changed': 6.9900000000000002, 'delta_std': '3.4948x larger', 'std_base': 0.08729261137118062, 't_msg': 'Not significant\n'}],
+        ['twisted_iteration', 'SimpleComparisonResult', {'base_time': 0.148289627437, 'changed_time': 0.035354803126799998, 'time_delta': '4.1943x faster'}],
+        ['twisted_web', 'SimpleComparisonResult', {'base_time': 0.11312217194599999, 'changed_time': 0.625, 'time_delta': '5.5250x slower'}]
+    ]
+    
+    def testGoodInput(self):
+        '''Given correct result data, check that every result being saved has the right parameters'''
+        for resultparams in saveresults.save("pypy", 71212, self.fixture, "", "trunk", "pypy-c-jit", "gc=hybrid", True):
+            self.assertEqual(resultparams['revision_project'], "pypy")
+            self.assertEqual(resultparams['revision_number'], 71212)
+            self.assertEqual(resultparams['interpreter_name'], "pypy-c-jit")
+            self.assertEqual(resultparams['interpreter_coptions'], "gc=hybrid")
+            # get dict with correct data for this benchmark
+            fixturedata = []
+            benchfound = False
+            for res in self.fixture:
+                if res[0] == resultparams['benchmark_name']:
+                    fixturedata = res
+                    benchfound = True
+                    break
+            self.assertTrue(benchfound)
+            # get correct result value depending on the type of result
+            fixturevalue = 0
+            if fixturedata[1] == "SimpleComparisonResult":
+                fixturevalue = fixturedata[2]['changed_time']
+            else:
+                fixturevalue = fixturedata[2]['avg_changed']
+            self.assertEqual(resultparams['result_value'], fixturevalue)
+
+if __name__ == "__main__":
+    unittest.main()



More information about the Pypy-commit mailing list