diff options
author | mbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4> | 2008-03-06 00:07:48 +0000 |
---|---|---|
committer | mbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4> | 2008-03-06 00:07:48 +0000 |
commit | 5da9b641f205fbed8dfd2905e5c9aec915bf2d82 (patch) | |
tree | 0d07abb2516155d5f318024944dbf77d084943a7 /tko/machine_benchmark.cgi | |
parent | ff578ecd00e645a1241d4d5dceafe70c666d4db2 (diff) |
add back missing machine_benchmark.cgi
Signed-off-by: Martin J. Bligh <mbligh@google.com>
git-svn-id: svn://test.kernel.org/autotest/trunk@1307 592f7852-d20e-0410-864c-8624ca9c26a4
Diffstat (limited to 'tko/machine_benchmark.cgi')
-rwxr-xr-x | tko/machine_benchmark.cgi | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/tko/machine_benchmark.cgi b/tko/machine_benchmark.cgi new file mode 100755 index 00000000..d0b1aef0 --- /dev/null +++ b/tko/machine_benchmark.cgi @@ -0,0 +1,70 @@ +#!/usr/bin/python +print "Content-type: text/html\n" +import cgi, cgitb, os, sys, re +sys.stdout.flush() +cgitb.enable() + +tko = os.path.dirname(os.path.realpath(os.path.abspath(sys.argv[0]))) +sys.path.insert(0, tko) +import db, display, frontend + +db = db.db() + +benchmark_key = { +'kernbench' : 'elapsed', +'dbench' : 'throughput', +'tbench' : 'throughput', +} + +def main(): + + display.print_main_header() + + rows = db.select('test', 'tests', {}, distinct = True) + benchmarks = [] + for row in rows: + benchmark = row[0] + testname = re.sub(r'\..*', '', benchmark) + if not benchmark_key.has_key(testname): + continue + benchmarks.append(benchmark) + benchmarks = display.sort_tests(benchmarks) + + machine_idx = {} + benchmark_data = {} + for benchmark in benchmarks: + fields = 'machine_idx,machine_hostname,count(status_word)' + where = { 'subdir': benchmark, 'status_word' : 'GOOD' } + data = {} + for (idx, machine, count) in db.select(fields, 'test_view', + where, group_by = 'machine_hostname'): + data[machine] = count + machine_idx[machine] = idx + benchmark_data[benchmark] = data + + print '<h1>Performance</h1>' + + header_row = [ display.box('Benchmark', header=True) ] + header_row += [ display.box(re.sub(r'\.', '<br>', benchmark), header=True) for benchmark in benchmarks ] + + matrix = [header_row] + for machine in machine_idx: + row = [display.box(machine)] + for benchmark in benchmarks: + count = benchmark_data[benchmark].get(machine, None) + if not count: + row.append(display.box(None)) + continue + key = benchmark_key[re.sub(r'\..*', '', benchmark)] + url = 'machine_test_attribute_graph.cgi' + url += '?machine=' + str(machine_idx[machine]) + url += '&benchmark=' + benchmark + url += '&key=' + key + html = '<a href="%s">%d</a>' % (url, count) + row.append(display.box(html)) + matrix.append(row) + matrix.append(header_row) + + display.print_table(matrix) + +main() |