1 #!/usr/bin/python 2 3 # http://test.kernel.org/perf/kernbench.elm3b6.png 4 5 import cgi, cgitb, os, sys, re, subprocess 6 cgitb.enable() 7 Popen = subprocess.Popen 8 9 import common 10 from autotest_lib.tko import db, display, frontend, plotgraph 11 from autotest_lib.client.common_lib import kernel_versions 12 13 db = db.db() 14 15 def main(): 16 form = cgi.FieldStorage() 17 machine_idx = form["machine"].value 18 benchmark = form["benchmark"].value 19 key = form["key"].value 20 21 machine = frontend.machine.select(db, {'machine_idx' : machine_idx})[0] 22 23 data = {} 24 where = { 'subdir' : benchmark, 'machine_idx' : machine.idx } 25 for test in frontend.test.select(db, where): 26 iterations = test.iterations() 27 if iterations.has_key(key): 28 data[test.kernel().printable] = iterations[key] 29 30 # for kernel in sort_kernels(data.keys()): 31 # print "%s %s" % (kernel, str(data[kernel])) 32 title = "%s on %s" % (benchmark, machine.hostname) 33 graph = plotgraph.gnuplot(title, 'Kernel', key, xsort = sort_kernels) 34 graph.add_dataset('all kernels', data) 35 graph.plot(cgi_header = True) 36 37 38 def sort_kernels(kernels): 39 return sorted(kernels, key = kernel_versions.version_encode) 40 41 main() 42