[pypy-svn] r71805 - in codespeed/pyspeed: codespeed templates
tobami at codespeak.net
tobami at codespeak.net
Fri Mar 5 16:30:26 CET 2010
Author: tobami
Date: Fri Mar 5 16:30:24 2010
New Revision: 71805
Modified:
codespeed/pyspeed/codespeed/views.py
codespeed/pyspeed/templates/overview.html
codespeed/pyspeed/templates/overview_table.html
codespeed/pyspeed/templates/timeline.html
Log:
changed permalinkToTimeline so that it selects both default interpreters. Changed arithmetic average implementation. Refactored a bit duplicated colortable and update table overview.html code
Modified: codespeed/pyspeed/codespeed/views.py
==============================================================================
--- codespeed/pyspeed/codespeed/views.py (original)
+++ codespeed/pyspeed/codespeed/views.py Fri Mar 5 16:30:24 2010
@@ -146,6 +146,7 @@
).filter(interpreter=1)
table_list = []
+ totals = {'change': [], 'trend': [], 'relative': []}
for bench in Benchmark.objects.all():
resultquery = result_list.filter(benchmark=bench)
if not len(resultquery): continue
@@ -155,6 +156,7 @@
c = change_list.filter(benchmark=bench)
if c.count():
change = (result - c[0].value)*100/c[0].value
+ totals['change'].append(result / c[0].value)
#calculate past average
average = 0
@@ -174,7 +176,7 @@
if average:
average = average / averagecount
trend = (result - average)*100/average
- #trend = "%.2f" % trend
+ totals['trend'].append(result / average)
else:
trend = "-"
@@ -182,6 +184,7 @@
c = base_list.filter(benchmark=bench)
if c.count():
relative = c[0].value / result
+ totals['relative'].append(relative)
table_list.append({
'benchmark': bench.name,
'bench_description': bench.description,
@@ -191,15 +194,23 @@
'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]
+ # Compute Arithmetic averages
+ for key in totals.keys():
+ totals[key] = float(sum(totals[key]) / len(totals[key]))
+ totals['change'] = (totals['change'] - 1) * 100#transform ratio to percentage
+ totals['trend'] = (totals['trend'] - 1) * 100#transform ratio to percentage
+
+ # Compute Geometric average
+ #for key in totals:
+ #if not len(totals[key]):
+ #totals[key] = "-"
+ #continue
+ ## taken from python-statlib
+ #mult = 1.0
+ #one_over_n = 1.0/len(totals[key])
+ #for item in totals[key]:
+ #mult = mult * pow(item,one_over_n)
+ #totals[key] = mult - 1.0
return render_to_response('overview_table.html', locals())
Modified: codespeed/pyspeed/templates/overview.html
==============================================================================
--- codespeed/pyspeed/templates/overview.html (original)
+++ codespeed/pyspeed/templates/overview.html Fri Mar 5 16:30:24 2010
@@ -18,6 +18,11 @@
function permalinkToTimeline(benchmark) {
var conf = new Object();
conf["interpreters"] = $("input[name='interpreter']:checked").val();
+ //configure default interpreters checked (2 and 3)
+ //if interpreter is pypy-c or pypy-c-jit add the other one.
+ //If it is none of those keep just that one
+ if (conf["interpreters"] == "2") { conf["interpreters"] += ",3"; }
+ else if (conf["interpreters"] == "3") { conf["interpreters"] += ",2"; }
conf["benchmark"] = benchmark;
window.location="/timeline/?" + ued_encode(conf);
}
@@ -40,19 +45,7 @@
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);
- $(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());
- $(this).children("td:eq(4)").addClass(getColorcode(comp, 1+compthres, 1-compthres));
- });
- //process average row
- $("#results > tfoot > tr").each(function() {
+ $("#results > :not(thead) > 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));
@@ -65,9 +58,9 @@
function updateTable() {
colorTable();
//process table rows
+ var tdwidth = parseInt($("#results thead tr").find("th:eq(5)").css("width"));
$("#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, 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
@@ -78,7 +71,6 @@
//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"]);
});
Modified: codespeed/pyspeed/templates/overview_table.html
==============================================================================
--- codespeed/pyspeed/templates/overview_table.html (original)
+++ codespeed/pyspeed/templates/overview_table.html Fri Mar 5 16:30:24 2010
@@ -5,7 +5,7 @@
</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>
+ <tr><td class="text" title="Arithmetic mean of all benchmarks">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>
Modified: codespeed/pyspeed/templates/timeline.html
==============================================================================
--- codespeed/pyspeed/templates/timeline.html (original)
+++ codespeed/pyspeed/templates/timeline.html Fri Mar 5 16:30:24 2010
@@ -29,7 +29,7 @@
function renderPlot(data) {
if(data["error"] != "None") {
- h = parseInt($("#content").css("height"));
+ h = parseInt($("#content").css("height"));//get height for error message
$("#content").html(getLoadText(data["error"], h));
return 1;
}
@@ -160,7 +160,7 @@
</div>
<div id="configbar">Results for last
- <select id="revisions" title="Last {{ rev }} revisions tested">{% for rev in lastrevisions %}
+ <select id="revisions" title="Last {{ defaultlast }} revisions tested">{% for rev in lastrevisions %}
<option value="{{ rev }}">{{ rev }}</option>{% endfor %}
</select> revisions<a id="permalink" href="javascript:permalink();">Permalink</a>
</div>
More information about the Pypy-commit
mailing list