From: zooko Date: Sun, 6 Mar 2011 05:27:08 +0000 (+0530) Subject: bench: print out results in MB/sec instead of nanoseconds/byte and add more detail... X-Git-Url: https://git.rkrishnan.org/%5B%5E?a=commitdiff_plain;h=3ac09e94c612cddd82f0dcc47671ada91fab3beb;p=tahoe-lafs%2Fzfec.git bench: print out results in MB/sec instead of nanoseconds/byte and add more detail to legend Ignore-this: d12d509010f0beb0e94b5fd5c532d77a darcs-hash:b629d668137adb17a6b29a65dbd97f3be920bdf7 --- diff --git a/zfec/bench/bench_zfec.py b/zfec/bench/bench_zfec.py index fceaed4..93cb625 100644 --- a/zfec/bench/bench_zfec.py +++ b/zfec/bench/bench_zfec.py @@ -70,17 +70,26 @@ def _encode_data_fec(N): fecenc.encode(ds) def bench(k, m): + SIZE = 10**6 + MAXREPS = 64 # for f in [_encode_file_stringy_easyfec, _encode_file_stringy, _encode_file, _encode_file_not_really,]: # for f in [_encode_file,]: # for f in [_encode_file_not_really, _encode_file_not_really_and_hash, _encode_file, _encode_file_and_hash,]: # for f in [_encode_data_not_really, _encode_data_easyfec, _encode_data_fec,]: - print "measuring encoding of data with K=%d, M=%d, reporting results in nanoseconds per byte after encoding 4 MB..." % (k, m) + print "measuring encoding of data with K=%d, M=%d, reporting results in nanoseconds per byte after encoding %d bytes %d times in a row..." % (k, m, SIZE, MAXREPS) for f in [_encode_data_fec,]: def _init_func(size): return _make_new_rand_data(size, k, m) - for BSIZE in [2**22]: - benchutil.rep_bench(f, n=BSIZE, initfunc=_init_func, MAXREPS=64, MAXTIME=None, UNITS_PER_SECOND=1000000000) - benchutil.print_bench_footer(UNITS_PER_SECOND=1000000000) + for BSIZE in [SIZE]: + results = benchutil.rep_bench(f, n=BSIZE, initfunc=_init_func, MAXREPS=MAXREPS, MAXTIME=None, UNITS_PER_SECOND=1000000000) + print "and now represented in MB/s..." + print + best = results['best'] + mean = results['mean'] + worst = results['worst'] + print "best: % 4.3f MB/sec" % (10**3 / best) + print "mean: % 4.3f MB/sec" % (10**3 / mean) + print "worst: % 4.3f MB/sec" % (10**3 / worst) k = K m = M