diff options
author | Vladimir Sementsov-Ogievskiy | 2020-10-21 16:58:55 +0200 |
---|---|---|
committer | Max Reitz | 2020-12-18 12:35:55 +0100 |
commit | 8e979febb01222edb1e53fb61a93a4c803924869 (patch) | |
tree | b372c48742c3c553233777d47ae508117a23f5ec /scripts/simplebench/simplebench.py | |
parent | simplebench: rename ascii() to results_to_text() (diff) | |
download | qemu-8e979febb01222edb1e53fb61a93a4c803924869.tar.gz qemu-8e979febb01222edb1e53fb61a93a4c803924869.tar.xz qemu-8e979febb01222edb1e53fb61a93a4c803924869.zip |
simplebench: move results_to_text() into separate file
Let's keep view part in separate: this way it's better to improve it in
the following commits.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20201021145859.11201-18-vsementsov@virtuozzo.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'scripts/simplebench/simplebench.py')
-rw-r--r-- | scripts/simplebench/simplebench.py | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/scripts/simplebench/simplebench.py b/scripts/simplebench/simplebench.py index aa74b78a04..f61513af90 100644 --- a/scripts/simplebench/simplebench.py +++ b/scripts/simplebench/simplebench.py @@ -79,17 +79,6 @@ def bench_one(test_func, test_env, test_case, count=5, initial_run=True): return result -def result_to_text(result): - """Return text representation of bench_one() returned dict.""" - if 'average' in result: - s = '{:.2f} +- {:.2f}'.format(result['average'], result['stdev']) - if 'n-failed' in result: - s += '\n({} failed)'.format(result['n-failed']) - return s - else: - return 'FAILED' - - def bench(test_func, test_envs, test_cases, *args, **vargs): """Fill benchmark table @@ -125,23 +114,3 @@ def bench(test_func, test_envs, test_cases, *args, **vargs): print('Done') return results - - -def results_to_text(results): - """Return text representation of bench() returned dict.""" - from tabulate import tabulate - - dim = None - tab = [[""] + [c['id'] for c in results['envs']]] - for case in results['cases']: - row = [case['id']] - for env in results['envs']: - res = results['tab'][case['id']][env['id']] - if dim is None: - dim = res['dimension'] - else: - assert dim == res['dimension'] - row.append(result_to_text(res)) - tab.append(row) - - return f'All results are in {dim}\n\n' + tabulate(tab) |