summaryrefslogtreecommitdiff
path: root/tko/machine_test_attribute_graph.cgi
blob: 1f5b8b3ad84ae287dd4ae9a1a01679134173fb00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/python

# http://test.kernel.org/perf/kernbench.elm3b6.png

import cgi, cgitb, os, sys, re, subprocess
cgitb.enable()
Popen = subprocess.Popen

import common
from autotest_lib.tko import db, display, frontend, plotgraph
from autotest_lib.client.common_lib import kernel_versions

db = db.db()

def main():
    form = cgi.FieldStorage()
    machine_idx = form["machine"].value
    benchmark = form["benchmark"].value
    key = form["key"].value

    machine = frontend.machine.select(db, {'machine_idx' : machine_idx})[0]

    data = {}
    where = { 'subdir' : benchmark, 'machine_idx' : machine.idx }
    for test in frontend.test.select(db, where):
        iterations = test.iterations()
        if iterations.has_key(key):
            data[test.kernel().printable] = iterations[key]

    # for kernel in sort_kernels(data.keys()):
    #    print "%s %s" % (kernel, str(data[kernel]))
    title = "%s on %s" % (benchmark, machine.hostname)
    graph = plotgraph.gnuplot(title, 'Kernel', key, xsort = sort_kernels)
    graph.add_dataset('all kernels', data)
    graph.plot(cgi_header = True)


def sort_kernels(kernels):
    return sorted(kernels, key = kernel_versions.version_encode)

main()