pypy / pypy / translator / goal /

import os, sys
#from pypy.translator.goal import richards

modfilename = os.path.join(os.path.dirname(__file__), '')

# Number of times richards is imported in parallel.
# Can be changed on the command line, e.g.
# 20
take_options = True

# __________  Entry point  __________

def richards_main(fn, iterations):
    s = "Richards benchmark (RPython) starting...\n"
    os.write(1, s)
    result, startTime, endTime = fn(iterations)
    if not result:
        os.write(2, "Incorrect results!\n")
        return False
    os.write(1, "finished.\n")
    total_s = endTime - startTime
    avg = total_s * 1000 / iterations
    os.write(1, "Total time for %d iterations: %f secs\n" %(iterations, total_s))
    os.write(1, "Average time per iteration: %f ms\n" %(avg))
    return True

def entry_point(argv):
    for fn in functions:
        if not richards_main(fn, 10):
            return 1
    return 0

# _____ Define and setup target ___

def target(driver, args, config):
    global modules, functions
    if len(args) == 0:
    elif len(args) == 1:
        N = int(args[0])
        raise ValueError("too many command-line arguments")

    modules = []
    functions = []
    f = open(modfilename)
    source =
    for i in range(N):
        d = {'__name__': 'richards%d' % i}
        exec source in d

    return entry_point, None
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.