Skip to content

Commit

Permalink
Overview: Added average row. Fixed nav tabs for IE. Small fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
tobami committed Mar 2, 2010
1 parent 23fbec0 commit 88a0a1a
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 25 deletions.
47 changes: 37 additions & 10 deletions pyspeed/codespeed/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ def gettimelinedata(request):

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
Expand Down Expand Up @@ -54,19 +58,21 @@ def timeline(request):

# 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"])
Expand All @@ -83,15 +89,27 @@ def timeline(request):

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"])
Expand All @@ -103,7 +121,6 @@ def getoverviewtable(request):
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(
Expand Down Expand Up @@ -157,7 +174,7 @@ def getoverviewtable(request):
if average:
average = average / averagecount
trend = (result - average)*100/average
trend = "%.2f" % trend
#trend = "%.2f" % trend
else:
trend = "-"

Expand All @@ -174,6 +191,16 @@ def getoverviewtable(request):
'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):
Expand Down
36 changes: 26 additions & 10 deletions pyspeed/media/css/main.css
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -24,11 +25,16 @@ div#title h1 { line-height: 72px; margin: 0; font-style: italic; }
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;
Expand Down Expand Up @@ -157,8 +163,7 @@ table#results thead tr th.bar {
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;
Expand All @@ -170,6 +175,14 @@ table.tablesorter thead tr .header {
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;
Expand All @@ -194,7 +207,7 @@ table.tablesorter thead tr .headerSortDown, table.tablesorter thead tr .headerSo

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;
Expand All @@ -203,13 +216,16 @@ table.tablesorter tbody td.bar {
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;
Expand All @@ -218,8 +234,8 @@ table.tablesorter tbody span {
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;
Expand Down
21 changes: 18 additions & 3 deletions pyspeed/templates/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand All @@ -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() {
Expand Down Expand Up @@ -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 %}
Expand Down
5 changes: 4 additions & 1 deletion pyspeed/templates/overview_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
2 changes: 1 addition & 1 deletion pyspeed/templates/timeline.html
Original file line number Diff line number Diff line change
Expand Up @@ -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"]]]);
}
Expand Down

0 comments on commit 88a0a1a

Please sign in to comment.