summaryrefslogtreecommitdiff
path: root/print-historic-results.py
blob: 82046e986d64073bb55544271c52933c53959064 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/env python

# Copyright (C) 2014, Linaro Limited.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#
# Author: Andrew McDermott <andrew.mcdermott@linaro.org>

from htmltags import *

import os
import platform
import sqlite3
import sys
import time

if len(sys.argv) < 1:
    print >> sys.stderr, "usage: {} <filename>"
    sys.exit(1)

if not os.path.exists(sys.argv[1]):
    print >> sys.stderr, "error: database {} was not found".format(sys.argv[1])
    sys.exit(1)

server_max_jops_baseline = os.getenv('SERVER_MAX_JOPS_BASELINE', 1)
server_critical_jops_baseline = os.getenv('SERVER_CRITICAL_JOPS_BASELINE', 1)
title = os.path.basename(os.getenv("SPECJBB_PRODUCT_HOME"))

head = HEAD(TITLE("{} Result Archive ({})".format(title, platform.machine())))
head <= LINK(rel="stylesheet", href="style.css")
body = BODY()

body <= H2("Test Setup")
body <= P("""
This test measures the relative performance of the server compiler
running the {} composite tests and compares the performance
against the baseline performance of the server compiler
taken on {}.

In accordance with {}, the tests are run on a system which is not
production ready and does not meet all the requirements for publishing
compliant results. The numbers below shall be treated
as non-compliant (nc) and are for experimental purposes only.
""".format(A("SPECjbb2013", href="http://www.spec.org/jbb2013/"),
           os.getenv('BASEDATE'),
           A("[1]", href="#footnote-1")))

table = TABLE(border=1)
table <= TR(TH('Date') + TH('max-jOPS (nc)') + TH('critical-jOPS (nc)'))

conn = sqlite3.connect(sys.argv[1])
cursor = conn.cursor()

for row in cursor.execute("select date(datetime(timestamp, 'unixepoch', 'localtime')) as 'Date', max_jops, critical_jops from results order by date DESC"):
    html_row = TR()
    html_row <= TD(row[0])
    html_row <= TD("{:.2f}".format(row[1] / float(server_max_jops_baseline)), align="right")
    html_row <= TD("{:.2f}".format(row[2] / float(server_critical_jops_baseline)), align="right")
    table <= html_row

body <= H2("Historic Results (Relative Performance)")
body <= table
body <= HR()
body <= A("[1] " + A("http://www.spec.org/fairuse.html#Academic", href="http://www.spec.org/fairuse.html#Academic"), name="footnote-1")
body <= P("Page generated on: {}".format(time.strftime("%a, %d %b %Y %T %z")))
head <= body

print HTML(head)