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

tobami at codespeak.net tobami at codespeak.net
Tue Mar 2 13:14:56 CET 2010


Author: tobami
Date: Tue Mar  2 13:14:54 2010
New Revision: 71619

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
Log:
Overview: Added average row. Fixed nav tabs for IE. Small fixes.

Modified: codespeed/pyspeed/codespeed/views.py
==============================================================================
--- codespeed/pyspeed/codespeed/views.py	(original)
+++ codespeed/pyspeed/codespeed/views.py	Tue Mar  2 13:14:54 2010
@@ -22,7 +22,11 @@
     
     result_list = {}    
     baseline = Interpreter.objects.get(id=1)
-    baselinerev = Revision.objects.get(tag="2.6.2")
+    baselinerev = lastbase = Revision.objects.filter(
+        tag__isnull=False
+    ).filter(
+        project='cpython'
+    ).order_by('-number')[0]
     if data["baseline"] == "true":
         result_list["baseline"] = Result.objects.get(
             interpreter=baseline, benchmark=data["benchmark"], revision=baselinerev
@@ -54,19 +58,21 @@
     
     # Configuration of default parameters
     baseline = Interpreter.objects.get(id=1)
-    lastbase = Revision.objects.filter(
+    lastbaserev = Revision.objects.filter(
         tag__isnull=False
     ).filter(
         project='cpython'
     ).order_by('-number')[0]
-    baselinetag = lastbase.tag
+    baselinetag = lastbaserev.tag
+    baselinerev = lastbaserev.number
+
     defaultbaseline = True
     if data.has_key("baseline"):
         if data["baseline"] == "false":
             defaultbaseline = False
     
     defaulthost = 1
-    defaultbenchmark = 1
+    defaultbenchmark = 2
     if data.has_key("benchmark"):
         try:
             defaultbenchmark = int(data["benchmark"])
@@ -83,15 +89,27 @@
 
     lastrevisions = [50, 200, 1000]
     defaultlast = 200
-    if data.has_key("lastrevisions"):
-        if data["lastrevisions"] in lastrevisions:
-            defaultlast = data["lastrevisions"]
+    if data.has_key("revisions"):
+        if int(data["revisions"]) in lastrevisions:
+            defaultlast = data["revisions"]
     
     # Information for template
     interpreters = Interpreter.objects.filter(name__startswith=settings.PROJECT_NAME)
     benchmarks = Benchmark.objects.all()
     hostlist = Environment.objects.all()
-    return render_to_response('timeline.html', locals())
+    return render_to_response('timeline.html', {
+        'defaultinterpreters': defaultinterpreters,
+        'defaultbaseline': defaultbaseline,
+        'baseline': baseline,
+        'baselinetag': baselinetag,
+        'defaultbenchmark': defaultbenchmark,
+        'defaulthost': defaulthost,
+        'lastrevisions': lastrevisions,
+        'defaultlast': defaultlast,
+        'interpreters': interpreters,
+        'benchmarks': benchmarks,
+        'hostlist': hostlist
+    })
 
 def getoverviewtable(request):
     interpreter = int(request.GET["interpreter"])
@@ -103,7 +121,6 @@
     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(
@@ -157,7 +174,7 @@
         if average:
             average = average / averagecount
             trend =  (result - average)*100/average
-            trend = "%.2f" % trend
+            #trend = "%.2f" % trend
         else:
             trend = "-"
 
@@ -174,6 +191,16 @@
             'relative': relative
         })
     
+    totals = {'result': 0, 'change': 0, 'trend': 0, 'relative': 0}
+    lengths = {'result': 0, 'change': 0, 'trend': 0, 'relative': 0}
+    for row in table_list:
+        for key in totals.keys():
+            if type(row[key]) == float:
+                totals[key] += row[key]
+                lengths[key] += 1
+    for tot in totals:
+        if lengths[tot]: totals[tot] = totals[tot]/lengths[tot]
+
     return render_to_response('overview_table.html', locals())
     
 def overview(request):

Modified: codespeed/pyspeed/media/css/main.css
==============================================================================
--- codespeed/pyspeed/media/css/main.css	(original)
+++ codespeed/pyspeed/media/css/main.css	Tue Mar  2 13:14:54 2010
@@ -1,13 +1,14 @@
 body {
     min-width: 960px;
-    margin: 0; padding: 0; background-color: #596A74;
+    margin: 0; padding: 0;
+    background-color: #596A74;
     background-image: url(/media/images/vgradient-s.png);
     background-repeat: repeat-x;
 }
 a:link, a:visited { text-decoration: none; }
 a:hover { text-decoration: underline; }
 
-div#containter { width: 98%; margin-bottom: 1%; margin-left: auto; margin-right: auto; }
+div#containter { width: 98%; margin-left: auto; margin-right: auto; }
 
 div#title {
     position: relative;
@@ -24,11 +25,16 @@
 div#wrapper { margin: 0; }
 
 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 li {
+    display: inline-block;
+    vertical-align: top;
+    list-style: none;
+    zoom: 1; /* IE7 (hasLayout)*/
+    *display: inline; /* IE */
+}
 
 div#nav ul li a:link, div#nav ul li a:visited {
     display: block;
@@ -157,8 +163,7 @@
     text-align: center;
 }
 
-table.tablesorter thead tr td{}
-table.tablesorter thead tr th, table.tablesorter tfoot tr th {
+table.tablesorter thead tr th {
     background-color: #9DADC6;
     border: 1px solid #CDCDCD;
     font-size: 8pt;
@@ -170,6 +175,14 @@
     background-position: center right;
     cursor: pointer;
 }
+table.tablesorter tfoot tr td {
+    border: 2px solid #CDCDCD;
+    border-right: 1px solid #CDCDCD;
+    padding: 4px;
+    vertical-align: top;
+    text-align: right;
+}
+table.tablesorter tfoot tr td.text { text-align: left; }
 table.tablesorter tbody td {
     color: #3D3D3D;
     padding: 4px;
@@ -194,7 +207,7 @@
 
 table.tablesorter tbody td.text {text-align: left;}
 
-table.tablesorter tbody td.bar {
+table.tablesorter tbody td.bar, table.tablesorter tfoot tr td.bar {
     background-image: url(/media/images/gridline.png);
     background-repeat: repeat;
     background-position: left top;
@@ -203,13 +216,16 @@
     border: none;
     background-color:transparent;
 }
+
+table.tablesorter tfoot tr td.bar { border: 2px solid #CDCDCD; border-left: 1px solid #CDCDCD;}/*Firefox table border-collapse bug*/
+    
 table.tablesorter tbody td.bar img {
     vertical-align: middle;
     margin: 5px 5px 5px 0;
     border: none;
 }
 
-table.tablesorter tbody span {
+table.tablesorter tbody span, table.tablesorter tfoot span {
   display: block; 
   height: 1.45em;
   margin-top: 0.2em;
@@ -218,8 +234,8 @@
   overflow: hidden; 
 }
 
-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-red, .status-red  { background-color: #FF5640; }
+table.tablesorter tbody tr td.status-green, .status-green { background-color: #9FD54D; }
 /* table.tablesorter tbody tr td.status-yellow { background-color: #FEE772; } */
 table.tablesorter tbody tr.highlight td {
     background-color: #9DADC6 !important;

Modified: codespeed/pyspeed/templates/overview.html
==============================================================================
--- codespeed/pyspeed/templates/overview.html	(original)
+++ codespeed/pyspeed/templates/overview.html	Tue Mar  2 13:14:54 2010
@@ -51,10 +51,20 @@
       var comp = parseFloat($(this).children("td:eq(4)").text());
       $(this).children("td:eq(4)").addClass(getColorcode(comp, 1+compthres, 1-compthres));
     });
+    //process average row
+    $("#results > tfoot > tr").each(function() {
+      //Color change column
+      var change = $(this).children("td:eq(2)").text().slice(0, -1);
+      $(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));
+    });
   }
   
   function updateTable() {
     colorTable();
+    //process table rows
     $("#results > tbody > tr").each(function() {
       //Size plot bars
       var tdwidth = parseInt($("#results thead tr").find("th:eq(5)").css("width"));
@@ -65,8 +75,15 @@
         permalinkToTimeline($(this).children("td:eq(0)").text());
       });
     });
+    //process average row
+    $("#results > tfoot > tr").each(function() {
+      //Size plot bar for Average
+      var tdwidth = parseInt($("#results thead tr").find("th:eq(5)").css("width"));
+      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"]);
+    });
     //Configure table as tablesorter
-    $.tablesorter.defaults.sortList = [[4,0]];//sort by default by the 5th column
+    $.tablesorter.defaults.sortList = [[4,1]];//sort by default by the 5th column
     $.tablesorter.defaults.headers = { 5: { sorter: false } };//disable sorting for bar column
     $("#results").tablesorter({widgets: ['zebra']});
     $("#results tbody td").hover(function() {
@@ -104,13 +121,11 @@
 {% endblock %}
 
 {% block navigation %}
-<!--   <div id="tabs"> -->
     <ul>
       <li><a href="/overview/" class="current">Overview</a></li>
       <li><a href="/timeline/">Timeline</a></li>
 <!--       <li><a href="/comparison/">Comparison</a></li> -->
     </ul>
-<!--   </div> -->
 {% endblock %}
 
 {% block body %}

Modified: codespeed/pyspeed/templates/overview_table.html
==============================================================================
--- codespeed/pyspeed/templates/overview_table.html	(original)
+++ codespeed/pyspeed/templates/overview_table.html	Tue Mar  2 13:14:54 2010
@@ -4,9 +4,12 @@
     <th class="w">Benchmark</th><th class="w">Time (s)</th><th class="w">Current change</th><th class="w">Trend ({{ trendconfig }})</th><th class="w" title="Compared to cpython">Times cpython</th><th class="bar" title="Compared to cpython in log 2 scale"><div style="float:left;font-size:smaller;">slower</div><div style="float:left;margin-left:48px;">(log<sub>2</sub> scale)</div><div style="float:left;margin-left:60px;font-size:smaller;">faster</div></th>
   </tr>
 </thead>
+<tfoot>
+  <tr><td class="text">Average</td><td></td><td>{{ totals.change|floatformat:2 }}%</td><td>{{ totals.trend|floatformat:2 }}%</td><td>{{ totals.relative|floatformat:2 }}</td><td class="bar"><span>-</span></td></tr>
+</tfoot>
 <tbody>
 {% for row in table_list %}  <tr>
-        <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>
+        <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>{% ifequal row.trend "-" %}-{% endifequal %}{% ifnotequal row.trend "-" %}{{ row.trend|floatformat:2 }}%{% 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	Tue Mar  2 13:14:54 2010
@@ -54,7 +54,7 @@
       series.push({
         "label": $("label[for*='baseline']").html(), "color": seriesColors[id-1],
         showMarker: false, 
-        lineWidth: 1
+        lineWidth: 1.5
       });
       plotdata.push([[xmin, data["baseline"]], [xmax, data["baseline"]]]);
     }



More information about the Pypy-commit mailing list