Commit 72aca8d6 authored by Kevin Modzelewski's avatar Kevin Modzelewski

These scripts have moved to the pyston_perf repo

parent b82fd22e
#!/usr/bin/env python
import commands
import os.path
import subprocess
import time
import submit
def run_tests(executables, benchmarks, callback):
times = [[] for e in executables]
for b in benchmarks:
for e, time_list in zip(executables, times):
start = time.time()
subprocess.check_call(e.args + [b], stdout=open("/dev/null", 'w'))
elapsed = time.time() - start
print "%s %s: % 4.1fs" % (e.name.rjust(15), b.ljust(35), elapsed)
time_list.append(elapsed)
if callback:
callback(e, b, elapsed)
for e, time_list in zip(executables, times):
t = 1
for elapsed in time_list:
t *= elapsed
t **= (1.0 / len(time_list))
print "%s %s: % 4.1fs" % (e.name.rjust(15), "geomean".ljust(35), t)
class Executable(object):
def __init__(self, args, name):
self.args = args
self.name = name
def main():
executables = [Executable(["./pyston_release", "-q"], "pyston")]
RUN_CPYTHON = 0
if RUN_CPYTHON:
executables.append(Executable(["python"], "cpython 2.7"))
DO_SUBMIT = 1
# if RUN_PYPY:
# executables.append(Executable(["python"], "cpython 2.7"))
benchmarks = []
benchmarks += ["../microbenchmarks/%s" % s for s in [
]]
benchmarks += ["../minibenchmarks/%s" % s for s in [
"fannkuch_med.py",
"nbody_med.py",
"interp2.py",
"raytrace.py",
"chaos.py",
"nbody.py",
"fannkuch.py",
"spectral_norm.py",
]]
GIT_REV = commands.getoutput("git rev-parse HEAD")
def submit_callback(exe, benchmark, elapsed):
benchmark = os.path.basename(benchmark)
assert benchmark.endswith(".py")
benchmark = benchmark[:-3]
commitid = GIT_REV
if "cpython" in exe.name:
commitid = "default"
submit.submit(commitid=commitid, benchmark=benchmark, executable=exe.name, value=elapsed)
callback = None
if DO_SUBMIT:
callback = submit_callback
run_tests(executables, benchmarks, callback)
if __name__ == "__main__":
main()
# Submission library based on the codespeed example:
from datetime import datetime
import socket
import urllib
import urllib2
# You need to enter the real URL and have the server running
CODESPEED_URL = 'http://speed.pyston.org/'
def _formdata(commitid, benchmark, executable, value):
hostname = socket.gethostname()
if "cpython" in executable.lower():
project = "CPython"
else:
project = "Pyston"
# Mandatory fields
data = {
'commitid': commitid,
'branch': 'default', # Always use default for trunk/master/tip
'project': project,
'executable': executable,
'benchmark': benchmark,
'environment': hostname,
'result_value': value,
}
"""
# Optional fields
current_date = datetime.today()
data.update({
'revision_date': current_date, # Optional. Default is taken either
# from VCS integration or from current date
'result_date': current_date, # Optional, default is current date
})
"""
return data
def submit(commitid, benchmark, executable, value):
data = _formdata(commitid, benchmark, executable, value)
params = urllib.urlencode(data)
response = "None"
print "Saving result for executable %s, revision %s, benchmark %s" % (
data['executable'], data['commitid'], data['benchmark'])
try:
f = urllib2.urlopen(CODESPEED_URL + 'result/add/', params)
except urllib2.HTTPError as e:
print str(e)
print e.read()
raise
response = f.read()
f.close()
print "Server (%s) response: %s\n" % (CODESPEED_URL, response)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment