aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2021-01-28 18:13:48 +0300
committerVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2021-05-04 11:37:26 +0300
commit27eacb390e289edde4854f8bdface596572b0d8d (patch)
treed705b588319179cb532a5c3b9c3fc561c9f76d9c /scripts
parentdab346986e1e91dfd28671e9fb97970a9eb15fca (diff)
simplebench: bench_one(): support count=1
statistics.stdev raises if sequence length is less than two. Support that case by hand. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/simplebench/simplebench.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/simplebench/simplebench.py b/scripts/simplebench/simplebench.py
index 0a3035732c..27bc4d4715 100644
--- a/scripts/simplebench/simplebench.py
+++ b/scripts/simplebench/simplebench.py
@@ -83,7 +83,10 @@ def bench_one(test_func, test_env, test_case, count=5, initial_run=True,
dim = 'seconds'
result['dimension'] = dim
result['average'] = statistics.mean(r[dim] for r in succeeded)
- result['stdev'] = statistics.stdev(r[dim] for r in succeeded)
+ if len(succeeded) == 1:
+ result['stdev'] = 0
+ else:
+ result['stdev'] = statistics.stdev(r[dim] for r in succeeded)
if len(succeeded) < count:
result['n-failed'] = count - len(succeeded)