blob: 0c7bc7d9132a1c216bb0a77584b59222dde203cd [file] [log] [blame]
mbligh378e0ae2008-03-06 00:07:48 +00001#!/usr/bin/python
2print "Content-type: text/html\n"
3import cgi, cgitb, os, sys, re
4sys.stdout.flush()
5cgitb.enable()
6
jadmanski22ab0692008-05-01 22:22:51 +00007import common
8from autotest_lib.tko import db, display, frontend
mbligh378e0ae2008-03-06 00:07:48 +00009
10db = db.db()
11
12benchmark_key = {
13'kernbench' : 'elapsed',
14'dbench' : 'throughput',
15'tbench' : 'throughput',
16}
17
18def main():
19
20 display.print_main_header()
21
22 rows = db.select('test', 'tests', {}, distinct = True)
23 benchmarks = []
24 for row in rows:
25 benchmark = row[0]
26 testname = re.sub(r'\..*', '', benchmark)
27 if not benchmark_key.has_key(testname):
28 continue
29 benchmarks.append(benchmark)
30 benchmarks = display.sort_tests(benchmarks)
31
32 machine_idx = {}
33 benchmark_data = {}
34 for benchmark in benchmarks:
35 fields = 'machine_idx,machine_hostname,count(status_word)'
36 where = { 'subdir': benchmark, 'status_word' : 'GOOD' }
37 data = {}
38 for (idx, machine, count) in db.select(fields, 'test_view',
39 where, group_by = 'machine_hostname'):
40 data[machine] = count
41 machine_idx[machine] = idx
42 benchmark_data[benchmark] = data
43
44 print '<h1>Performance</h1>'
45
46 header_row = [ display.box('Benchmark', header=True) ]
47 header_row += [ display.box(re.sub(r'\.', '<br>', benchmark), header=True) for benchmark in benchmarks ]
48
49 matrix = [header_row]
50 for machine in machine_idx:
51 row = [display.box(machine)]
52 for benchmark in benchmarks:
53 count = benchmark_data[benchmark].get(machine, None)
54 if not count:
55 row.append(display.box(None))
56 continue
57 key = benchmark_key[re.sub(r'\..*', '', benchmark)]
58 url = 'machine_test_attribute_graph.cgi'
59 url += '?machine=' + str(machine_idx[machine])
60 url += '&benchmark=' + benchmark
61 url += '&key=' + key
62 html = '<a href="%s">%d</a>' % (url, count)
63 row.append(display.box(html))
64 matrix.append(row)
65 matrix.append(header_row)
66
67 display.print_table(matrix)
68
69main()