Added bench.py and bench_runner.c for benchmarking
These are really just different flavors of test.py and test_runner.c
without support for power-loss testing, but with support for measuring
the cumulative number of bytes read, programmed, and erased.
Note that the existing define parameterization should work perfectly
fine for running benchmarks across various dimensions:
./scripts/bench.py \
runners/bench_runner \
bench_file_read \
-gnor \
-DSIZE='range(0,131072,1024)'
Also added a couple basic benchmarks as a starting point.
This commit is contained in:
Executable
+1355
File diff suppressed because it is too large
Load Diff
+2
-1
@@ -28,7 +28,8 @@ MERGES = {
|
||||
'add': (
|
||||
['code_size', 'data_size', 'stack_frame', 'struct_size',
|
||||
'coverage_lines', 'coverage_branches',
|
||||
'test_passed'],
|
||||
'test_passed',
|
||||
'bench_read', 'bench_prog', 'bench_erased'],
|
||||
lambda xs: sum(xs[1:], start=xs[0])
|
||||
),
|
||||
'mul': (
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ def main(path='-', *, lines=1, sleep=0.01, keep_open=False):
|
||||
if not keep_open:
|
||||
break
|
||||
# don't just flood open calls
|
||||
time.sleep(sleep)
|
||||
time.sleep(sleep or 0.1)
|
||||
done = True
|
||||
|
||||
th.Thread(target=read, daemon=True).start()
|
||||
|
||||
+5
-3
@@ -388,7 +388,7 @@ def compile(test_paths, **args):
|
||||
f.writeln('#define %-24s '
|
||||
'TEST_IMPLICIT_DEFINE_COUNT+%d' % (define+'_i', i))
|
||||
f.writeln('#define %-24s '
|
||||
'test_define(%s)' % (define, define+'_i'))
|
||||
'TEST_DEFINE(%s)' % (define, define+'_i'))
|
||||
f.writeln('#endif')
|
||||
f.writeln()
|
||||
|
||||
@@ -486,7 +486,7 @@ def compile(test_paths, **args):
|
||||
'TEST_IMPLICIT_DEFINE_COUNT+%d' % (
|
||||
define+'_i', i))
|
||||
f.writeln('#define %-24s '
|
||||
'test_define(%s)' % (
|
||||
'TEST_DEFINE(%s)' % (
|
||||
define, define+'_i'))
|
||||
f.writeln('#define '
|
||||
'__TEST__%s__NEEDS_UNDEF' % (
|
||||
@@ -1018,7 +1018,9 @@ def run(runner, test_ids=[], **args):
|
||||
trace = openio(args['trace'], 'w', 1)
|
||||
output = None
|
||||
if args.get('output'):
|
||||
output = TestOutput(args['output'], ['suite', 'case'], ['test_passed'])
|
||||
output = TestOutput(args['output'],
|
||||
['suite', 'case'],
|
||||
['test_passed'])
|
||||
|
||||
# measure runtime
|
||||
start = time.time()
|
||||
|
||||
+2
-2
@@ -607,7 +607,7 @@ def main(path='-', *,
|
||||
if not keep_open:
|
||||
break
|
||||
# don't just flood open calls
|
||||
time.sleep(sleep)
|
||||
time.sleep(sleep or 0.1)
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
else:
|
||||
@@ -627,7 +627,7 @@ def main(path='-', *,
|
||||
if not keep_open:
|
||||
break
|
||||
# don't just flood open calls
|
||||
time.sleep(sleep)
|
||||
time.sleep(sleep or 0.1)
|
||||
done = True
|
||||
|
||||
th.Thread(target=parse, daemon=True).start()
|
||||
|
||||
Reference in New Issue
Block a user