import util
import optparse
import time

def fak(x):
    r = 1
    while x > 1:
        r *= x
        x -= 1
    return r

def main(arg):
    times = []
    for i in xrange(arg):
        t0 = time.time()
        o = fak(7000)
        tk = time.time()
        times.append(tk - t0)
    return times

if __name__ == "__main__":
    parser = optparse.OptionParser(
        usage="%prog [options]",
        description="Test the performance of the Fak benchmark")
    util.add_standard_options_to(parser)
    options, args = parser.parse_args()

    util.run_benchmark(options, options.num_runs, main)
