On 18.09.20 20:19, Vladimir Sementsov-Ogievskiy wrote: > Support benchmarks returning not seconds but iops. We'll use it for > further new test. > > Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]> > --- > scripts/simplebench/simplebench.py | 35 +++++++++++++++++++++++------- > 1 file changed, 27 insertions(+), 8 deletions(-) > > diff --git a/scripts/simplebench/simplebench.py > b/scripts/simplebench/simplebench.py > index 59e7314ff6..716d7fe9b2 100644 > --- a/scripts/simplebench/simplebench.py > +++ b/scripts/simplebench/simplebench.py
[...]
> @@ -34,6 +37,7 @@ def bench_one(test_func, test_env, test_case, count=5,
> initial_run=True):
>
> Returns dict with the following fields:
> 'runs': list of test_func results
> + 'dimension': dimension of results, may be 'seconds' or 'iops'
> 'average': average seconds per run (exists only if at least one run
s/seconds/value/ (or something like that)
> succeeded)
> 'delta': maximum delta between test_func result and the average
> @@ -54,11 +58,20 @@ def bench_one(test_func, test_env, test_case, count=5,
> initial_run=True):
>
> result = {'runs': runs}
>
> - successed = [r for r in runs if ('seconds' in r)]
> + successed = [r for r in runs if ('seconds' in r or 'iops' in r)]
> if successed:
((Pre-existing, but I feel the urge to point it that it should be
“succeeded”. (Or perhaps “successes”.)
Sorry, not something that should be fixed here, but I just couldn’t
contain myself.))
> - avg = sum(r['seconds'] for r in successed) / len(successed)
> + dim = 'iops' if ('iops' in successed[0]) else 'seconds'
I think this line should be dropped, because it’s obsoleted by the
if-else that follows.
> + if 'iops' in successed[0]:
> + assert all('iops' in r for r in successed)
> + dim = 'iops'
> + else:
> + assert all('seconds' in r for r in successed)
> + assert all('iops' not in r for r in successed)
> + dim = 'seconds'
Max
signature.asc
Description: OpenPGP digital signature
