[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v7 15/21] scripts/simplebench: use standard deviation for +- erro
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[PATCH v7 15/21] scripts/simplebench: use standard deviation for +- error |
Date: |
Wed, 21 Oct 2020 17:58:53 +0300 |
Standard deviation is more usual to see after +- than current maximum
of deviations.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
scripts/simplebench/simplebench.py | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/scripts/simplebench/simplebench.py
b/scripts/simplebench/simplebench.py
index 2251cd34ea..55ec1ad5db 100644
--- a/scripts/simplebench/simplebench.py
+++ b/scripts/simplebench/simplebench.py
@@ -18,6 +18,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
+import statistics
+
def bench_one(test_func, test_env, test_case, count=5, initial_run=True):
"""Benchmark one test-case
@@ -40,7 +42,7 @@ def bench_one(test_func, test_env, test_case, count=5,
initial_run=True):
'dimension': dimension of results, may be 'seconds' or 'iops'
'average': average value (iops or seconds) per run (exists only if at
least one run succeeded)
- 'delta': maximum delta between test_func result and the average
+ 'stdev': standard deviation of results
(exists only if at least one run succeeded)
'n-failed': number of failed runs (exists only if at least one run
failed)
@@ -67,10 +69,9 @@ def bench_one(test_func, test_env, test_case, count=5,
initial_run=True):
assert all('seconds' in r for r in succeeded)
assert all('iops' not in r for r in succeeded)
dim = 'seconds'
- avg = sum(r[dim] for r in succeeded) / len(succeeded)
result['dimension'] = dim
- result['average'] = avg
- result['delta'] = max(abs(r[dim] - avg) for r in succeeded)
+ result['average'] = statistics.mean(r[dim] for r in succeeded)
+ result['stdev'] = statistics.stdev(r[dim] for r in succeeded)
if len(succeeded) < count:
result['n-failed'] = count - len(succeeded)
@@ -81,7 +82,7 @@ def bench_one(test_func, test_env, test_case, count=5,
initial_run=True):
def ascii_one(result):
"""Return ASCII representation of bench_one() returned dict."""
if 'average' in result:
- s = '{:.2f} +- {:.2f}'.format(result['average'], result['delta'])
+ s = '{:.2f} +- {:.2f}'.format(result['average'], result['stdev'])
if 'n-failed' in result:
s += '\n({} failed)'.format(result['n-failed'])
return s
--
2.21.3
- [PATCH v7 01/21] block: simplify comment to BDRV_REQ_SERIALISING, (continued)
- [PATCH v7 01/21] block: simplify comment to BDRV_REQ_SERIALISING, Vladimir Sementsov-Ogievskiy, 2020/10/21
- [PATCH v7 03/21] block/io: split out bdrv_find_conflicting_request, Vladimir Sementsov-Ogievskiy, 2020/10/21
- [PATCH v7 04/21] block/io: bdrv_wait_serialising_requests_locked: drop extra bs arg, Vladimir Sementsov-Ogievskiy, 2020/10/21
- [PATCH v7 05/21] block: bdrv_mark_request_serialising: split non-waiting function, Vladimir Sementsov-Ogievskiy, 2020/10/21
- [PATCH v7 06/21] block: introduce BDRV_REQ_NO_WAIT flag, Vladimir Sementsov-Ogievskiy, 2020/10/21
- [PATCH v7 14/21] scripts/simplebench: support iops, Vladimir Sementsov-Ogievskiy, 2020/10/21
- [PATCH v7 08/21] block: introduce preallocate filter, Vladimir Sementsov-Ogievskiy, 2020/10/21
- [PATCH v7 09/21] qemu-io: add preallocate mode parameter for truncate command, Vladimir Sementsov-Ogievskiy, 2020/10/21
- [PATCH v7 16/21] simplebench: rename ascii() to results_to_text(), Vladimir Sementsov-Ogievskiy, 2020/10/21
- [PATCH v7 07/21] block: bdrv_check_perm(): process children anyway, Vladimir Sementsov-Ogievskiy, 2020/10/21
- [PATCH v7 15/21] scripts/simplebench: use standard deviation for +- error,
Vladimir Sementsov-Ogievskiy <=
- [PATCH v7 10/21] iotests: qemu_io_silent: support --image-opts, Vladimir Sementsov-Ogievskiy, 2020/10/21
- [PATCH v7 11/21] iotests.py: execute_setup_common(): add required_fmts argument, Vladimir Sementsov-Ogievskiy, 2020/10/21
- [PATCH v7 12/21] iotests: add 298 to test new preallocate filter driver, Vladimir Sementsov-Ogievskiy, 2020/10/21
- [PATCH v7 13/21] scripts/simplebench: fix grammar: s/successed/succeeded/, Vladimir Sementsov-Ogievskiy, 2020/10/21
- [PATCH v7 17/21] simplebench: move results_to_text() into separate file, Vladimir Sementsov-Ogievskiy, 2020/10/21
- [PATCH v7 18/21] simplebench/results_to_text: improve view of the table, Vladimir Sementsov-Ogievskiy, 2020/10/21
- [PATCH v7 20/21] simplebench/results_to_text: make executable, Vladimir Sementsov-Ogievskiy, 2020/10/21
- [PATCH v7 19/21] simplebench/results_to_text: add difference line to the table, Vladimir Sementsov-Ogievskiy, 2020/10/21
- [PATCH v7 21/21] scripts/simplebench: add bench_prealloc.py, Vladimir Sementsov-Ogievskiy, 2020/10/21