Example #1
0
def main(args=sys.argv[1:]):
    sys.path.insert(0, build_lib_dirname())
    from pylibmc import build_info
    logger.info('Loaded %s', build_info())

    ps = [p for p in participants if p.name in args] if args else participants

    logger.info('Benchmarking %d participants in %d benchmarks',
                len(ps), len(benchmarks))

    bench(participants=ps)
Example #2
0
def main(args=sys.argv[1:]):
    sys.path.insert(0, build_lib_dirname())
    from pylibmc import build_info
    logger.info('Loaded %s', build_info())

    ps = [p for p in participants if p.name in args] if args else participants

    logger.info('Benchmarking %d participants in %d benchmarks', len(ps),
                len(benchmarks))

    bench(participants=ps)
Example #3
0
def main(args=sys.argv[1:]):
    sys.path.insert(0, build_lib_dirname())
    from pylibmc import build_info
    logger.info('Loaded %s', build_info())

    ps = [p for p in participants if p.name in args]
    ps = ps if ps else participants

    bs = benchmarks[:]

    logger.info('%d participants in %d benchmarks', len(ps), len(bs))

    means, stddevs = bench(participants=ps, benchmarks=bs)

    print 'labels =',     [p.name for p in ps]
    print 'benchmarks =', [b.name for b in bs]
    print 'means =',      means
    print 'stddevs =',    stddevs
Example #4
0
def main(args=sys.argv[1:]):
    sys.path.insert(0, build_lib_dirname())
    from pylibmc import build_info
    logger.info('Loaded %s', build_info())

    ps = participants
    bs = benchmarks

    logger.info('%d participants in %d benchmarks', len(ps), len(bs))

    import pickle

    # usages:
    #   runbench.py bench -- run benchmark once
    #   runbench.py dump [stats] -- run benchmark and write stats to file
    #   runbench.py plot [stats] [plot] -- load stats and write a plot to file

    def bench():
        workout = Workout(participants=ps, benchmarks=bs)
        workout.bench()
        workout.print_stats()
        return workout

    def dump(fn='tmp/timings.pickle'):
        workout = bench()
        with open(fn, 'wb') as f:
            pickle.dump(workout.timings, f)

    def plot(fn='tmp/timings.pickle', out='tmp/timing_plot.svg'):
        with open(fn, 'rb') as f:
            workout = Workout(timings=pickle.load(f))
        workout.print_stats()
        workout.plot(filename=out)

    if args:
        fs = (bench, dump, plot)
        f = {f.__name__: f for f in fs}[args[0]]
        f(*args[1:])
    else:
        bench()
Example #5
0
def main(args=sys.argv[1:]):
    sys.path.insert(0, build_lib_dirname())
    from pylibmc import build_info
    logger.info('Loaded %s', build_info())

    ps = participants
    bs = benchmarks

    logger.info('%d participants in %d benchmarks', len(ps), len(bs))

    import pickle

    # usages:
    #   runbench.py bench -- run benchmark once
    #   runbench.py dump [stats] -- run benchmark and write stats to file
    #   runbench.py plot [stats] [plot] -- load stats and write a plot to file

    def bench():
        workout = Workout(participants=ps, benchmarks=bs)
        workout.bench()
        workout.print_stats()
        return workout

    def dump(fn='tmp/timings.pickle'):
        workout = bench()
        with open(fn, 'wb') as f:
            pickle.dump(workout.timings, f)

    def plot(fn='tmp/timings.pickle', out='tmp/timing_plot.svg'):
        with open(fn, 'rb') as f:
            workout = Workout(timings=pickle.load(f))
        workout.print_stats()
        workout.plot(filename=out)

    if args:
        fs = (bench, dump, plot)
        f = dict((f.__name__, f) for f in fs)[args[0]]
        f(*args[1:])
    else:
        bench()
Example #6
0
 def begin(self):
     hack_sys_path()
     from pylibmc import build_info
     logger.info("testing %s", build_info())
Example #7
0
 def begin(self):
     hack_sys_path()
     from pylibmc import build_info
     logger.info("testing %s", build_info())
Example #8
0
def main(args=sys.argv[1:]):
    from pylibmc import build_info
    from pylibmc.test import make_test_client
    logger.info('benching %s', build_info())
    bench(make_test_client)
Example #9
0
def main(args=sys.argv[1:]):
    from pylibmc import build_info
    from pylibmc.test import make_test_client
    logger.info('benching %s', build_info())
    bench(make_test_client())