blob: de7b15458ca62b211d68e2de896459711f602175 [file] [log] [blame]
#!/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 "usage: {} <filename>"
sys.exit(1)
if not os.path.exists(sys.argv[1]):
print "error: database {} was not found".format(sys.argv[1])
sys.exit(1)
client_baseline = int(os.getenv('CLIENT_BASELINE'))
server_baseline = int(os.getenv('SERVER_BASELINE'))
zero_baseline = int(os.getenv('ZERO_BASELINE'))
head = HEAD(TITLE('Hadoop/Terasort Result Archive (' + platform.machine() + ')'))
head <= LINK(rel="stylesheet", href="style.css")
body = BODY()
body <= H2("Test Setup")
body <= P("\
This test measures the performance of the server and client compilers \
running Hadoop sorting a {}GB file using Terasort and compares \
the performance against the baseline performance of the Zero interpreter \
and against the baseline performance of the client and server compilers \
on {}.".format(os.getenv('NGIGABYTES'), os.getenv('BASEDATE')))
body <= P("\
Relative performance: Zero: 1.0, Client: {}, Server: {} taken on {}".format(os.getenv('CLIENT_BASELINE'),
os.getenv('SERVER_BASELINE'),
os.getenv('BASEDATE')))
table = TABLE(border=1)
table <= TR(TH('Date') + TH('JVM Variant') + TH('Relative performance'))
conn = sqlite3.connect(sys.argv[1])
cursor = conn.cursor()
for row in cursor.execute("select date(datetime(timestamp, 'unixepoch', 'localtime')) as 'Date', jvm_type, elapsed_time from results order by date DESC, jvm_type"):
html_row = TR()
html_row <= TD(row[0])
html_row <= TD(row[1])
html_row <= TD("{:.2f}".format(float(zero_baseline) / row[2]), align="right")
table <= html_row
body <= H2("Historic Results")
body <= table
body <= HR()
body <= P("Page generated on: {}".format(time.strftime("%Y-%m-%d %H:%M:%S %Z")))
print HTML(head + body)