mirror of
https://github.com/golang/go
synced 2024-11-23 21:10:05 -07:00
godashboard: fix benchmarks page (first pass)
R=rsc CC=golang-dev https://golang.org/cl/844044
This commit is contained in:
parent
f08ce18980
commit
7678c5bfa1
@ -1,68 +1,22 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Go benchmarks</title>
|
||||
|
||||
<style>
|
||||
h1 {
|
||||
font-size: 1em;
|
||||
font-weight: bold;
|
||||
}
|
||||
h2 {
|
||||
font-size: 1em;
|
||||
font-weight: bold;
|
||||
}
|
||||
table.alternate {
|
||||
white-space: nowrap;
|
||||
}
|
||||
table.alternate tr td {
|
||||
padding-right: 10px;
|
||||
}
|
||||
table.alternate tr td:last-child {
|
||||
padding-right: 0;
|
||||
}
|
||||
table.alternate tr:nth-child(2n) {
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
td.revision {
|
||||
}
|
||||
span.hash {
|
||||
font-family: monospace;
|
||||
font-size: small;
|
||||
color: #aaa;
|
||||
}
|
||||
span.nodeseq {
|
||||
}
|
||||
td.user {
|
||||
font-size: small;
|
||||
}
|
||||
td.date {
|
||||
color: #aaa;
|
||||
font-size: small;
|
||||
}
|
||||
td.result {
|
||||
text-align: center;
|
||||
}
|
||||
span.ok {
|
||||
}
|
||||
td.desc {
|
||||
font-size: small;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
th.builder {
|
||||
font-weight: bold;
|
||||
padding-right: 0.5em;
|
||||
}
|
||||
</style>
|
||||
<title>{{benchmark}} - Benchmarks - Go Dashboard</title>
|
||||
<link rel="stylesheet" type="text/css" href="/static/style.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Go dashboard - {{benchmark}}</h1>
|
||||
|
||||
<a href="/">build status</a> <br>
|
||||
<a href="/benchmarks">benchmarks</a>
|
||||
<ul class="menu">
|
||||
<li><a href="/">Build Status</a></li>
|
||||
<li><a href="/package">Packages</a></li>
|
||||
<li><a href="/benchmarks">Benchmarks</a></li>
|
||||
<li><a href="http://golang.org/">golang.org</a></li>
|
||||
</ul>
|
||||
|
||||
<h1>Go Dashboard</h1>
|
||||
|
||||
<h2>{{benchmark}}</h2>
|
||||
|
||||
<a href="{{benchmark}}?fmt=json">json</a>
|
||||
|
||||
{% for g in graphs %}
|
||||
|
@ -1,62 +1,22 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Go benchmarks</title>
|
||||
|
||||
<style>
|
||||
h1 {
|
||||
font-size: 1em;
|
||||
font-weight: bold;
|
||||
}
|
||||
h2 {
|
||||
font-size: 1em;
|
||||
font-weight: bold;
|
||||
}
|
||||
table.alternate {
|
||||
white-space: nowrap;
|
||||
}
|
||||
table.alternate tr td {
|
||||
padding-right: 10px;
|
||||
}
|
||||
table.alternate tr td:last-child {
|
||||
padding-right: 0;
|
||||
}
|
||||
table.alternate tr:nth-child(2n) {
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
td.revision {
|
||||
}
|
||||
span.nodeseq {
|
||||
}
|
||||
td.user {
|
||||
font-size: small;
|
||||
}
|
||||
td.date {
|
||||
color: #aaa;
|
||||
font-size: small;
|
||||
}
|
||||
td.result {
|
||||
text-align: center;
|
||||
}
|
||||
span.ok {
|
||||
}
|
||||
td.desc {
|
||||
font-size: small;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
th.builder {
|
||||
font-weight: bold;
|
||||
padding-right: 0.5em;
|
||||
}
|
||||
</style>
|
||||
<title>Benchmarks - Go Dashboard</title>
|
||||
<link rel="stylesheet" type="text/css" href="/static/style.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Go dashboard - benchmarks</h1>
|
||||
|
||||
<a href="/">build status</a>
|
||||
<ul class="menu">
|
||||
<li><a href="/">Build Status</a></li>
|
||||
<li><a href="/package">Packages</a></li>
|
||||
<li>Benchmarks</li>
|
||||
<li><a href="http://golang.org/">golang.org</a></li>
|
||||
</ul>
|
||||
|
||||
<h1>Go Dashboard</h1>
|
||||
|
||||
<h2>Benchmarks</h2>
|
||||
|
||||
<table class="alternate" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<th></th>
|
||||
@ -65,15 +25,17 @@
|
||||
{% endfor %}
|
||||
</tr>
|
||||
|
||||
{% for m in benchmarks %}
|
||||
{% for bm in rows %}
|
||||
<tr>
|
||||
<td class="name"><a href="/benchmarks/{{m.name}}">{{m.name}}</a></td>
|
||||
<td class="name"><a href="/benchmarks/{{bm.name}}">{{bm.name}}</a></td>
|
||||
|
||||
{% for b in m.builds %}
|
||||
{% for bl in bm.builders %}
|
||||
<td class="result">
|
||||
{% if b.url %}
|
||||
<img src="{{b.url}}&chs=80x20&chf=bg,s,00000000&chco=000000ff&chls=1,1,0">
|
||||
{% endif %}
|
||||
{% if bl.url %}
|
||||
<img src="{{bl.url}}" />
|
||||
{% else %}
|
||||
<img src="/benchmarks/single?benchmark={{bm.name}}&builder={{bl.name}}" />
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
|
@ -388,25 +388,20 @@ class Benchmarks(webapp.RequestHandler):
|
||||
|
||||
def compute(self, num):
|
||||
benchmarks, builders = benchmark_list()
|
||||
|
||||
# Build empty grid, to be filled in.
|
||||
rows = [{"name": bm, "builds": [{"url": ""} for b in builders]} for bm in benchmarks]
|
||||
|
||||
for i in range(len(rows)):
|
||||
benchmark = benchmarks[i]
|
||||
builds = rows[i]["builds"]
|
||||
minr, maxr, bybuilder = benchmark_data(benchmark)
|
||||
for j in range(len(builders)):
|
||||
builder = builders[j]
|
||||
cell = builds[j]
|
||||
if len(bybuilder) > 0 and builder == bybuilder[0][0]:
|
||||
cell["url"] = benchmark_sparkline(bybuilder[0][2])
|
||||
bybuilder = bybuilder[1:]
|
||||
rows = []
|
||||
for bm in benchmarks:
|
||||
row = {'name':bm, 'builders': []}
|
||||
for bl in builders:
|
||||
key = "single-%s-%s" % (bm, bl)
|
||||
url = memcache.get(key)
|
||||
row['builders'].append({'name': bl, 'url': url})
|
||||
rows.append(row)
|
||||
|
||||
path = os.path.join(os.path.dirname(__file__), 'benchmarks.html')
|
||||
data = {
|
||||
"benchmarks": rows,
|
||||
"builders": [builderInfo(b) for b in builders]
|
||||
"builders": [builderInfo(b) for b in builders],
|
||||
"rows": rows,
|
||||
}
|
||||
return template.render(path, data)
|
||||
|
||||
@ -464,6 +459,34 @@ class Benchmarks(webapp.RequestHandler):
|
||||
|
||||
self.response.set_status(200)
|
||||
|
||||
class SingleBenchmark(webapp.RequestHandler):
|
||||
"""
|
||||
Fetch data for single benchmark/builder combination
|
||||
and return sparkline url as HTTP redirect, also set memcache entry.
|
||||
"""
|
||||
def get(self):
|
||||
benchmark = self.request.get('benchmark')
|
||||
builder = self.request.get('builder')
|
||||
key = "single-%s-%s" % (benchmark, builder)
|
||||
|
||||
url = memcache.get(key)
|
||||
|
||||
if url is None:
|
||||
minr, maxr, bybuilder = benchmark_data(benchmark)
|
||||
for bb in bybuilder:
|
||||
if bb[0] != builder:
|
||||
continue
|
||||
url = benchmark_sparkline(bb[2])
|
||||
|
||||
if url is None:
|
||||
self.response.set_status(500, "No data found")
|
||||
return
|
||||
|
||||
memcache.set(key, url, 700) # slightly longer than bench timeout
|
||||
|
||||
self.response.set_status(302)
|
||||
self.response.headers.add_header("Location", url)
|
||||
|
||||
def node(num):
|
||||
q = Commit.all()
|
||||
q.filter('num =', num)
|
||||
@ -535,19 +558,19 @@ def benchmark_sparkline(ns):
|
||||
# Encoding is 0-61, which is fine enough granularity for our tiny graphs. _ means missing.
|
||||
encoding = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
|
||||
s = ''.join([x < 0 and "_" or encoding[int((len(encoding)-1)*x/m)] for x in ns])
|
||||
url = "http://chart.apis.google.com/chart?cht=ls&chd=s:"+s
|
||||
url = "http://chart.apis.google.com/chart?cht=ls&chd=s:"+s+"&chs=80x20&chf=bg,s,00000000&chco=000000ff&chls=1,1,0"
|
||||
return url
|
||||
|
||||
def benchmark_list():
|
||||
q = BenchmarkResults.all()
|
||||
q.order('__key__')
|
||||
q.filter('builder = ', u'darwin-amd64')
|
||||
benchmarks = [r.benchmark for r in q.fetch(1000)]
|
||||
benchmarks = [r.benchmark for r in q]
|
||||
|
||||
q = BenchmarkResults.all()
|
||||
q.order('__key__')
|
||||
q.filter('benchmark =', u'math_test.BenchmarkSqrt')
|
||||
builders = [r.builder for r in q.fetch(100)]
|
||||
builders = [r.builder for r in q.fetch(20)]
|
||||
|
||||
return benchmarks, builders
|
||||
|
||||
@ -682,6 +705,7 @@ application = webapp.WSGIApplication(
|
||||
('/init', Init),
|
||||
('/build', Build),
|
||||
('/benchmarks', Benchmarks),
|
||||
('/benchmarks/single', SingleBenchmark),
|
||||
('/benchmarks/.*', GetBenchmarks),
|
||||
], debug=True)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user