From 684d18efd1a35b75a6625072c68e1b7ea70bd3a8 Mon Sep 17 00:00:00 2001 From: Vladimir Sementsov-Ogievskiy Date: Thu, 28 Jan 2021 13:28:17 +0300 Subject: simplebench/bench-backup: add target-cache argument Allow benchmark with different kinds of target cache. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: John Snow --- scripts/simplebench/bench-backup.py | 33 ++++++++++++++++++++++++++------- scripts/simplebench/bench_block_job.py | 10 +++++++--- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/scripts/simplebench/bench-backup.py b/scripts/simplebench/bench-backup.py index 72eae85bb1..fbc85f266f 100755 --- a/scripts/simplebench/bench-backup.py +++ b/scripts/simplebench/bench-backup.py @@ -65,13 +65,26 @@ def bench(args): test_cases.append({'id': t, 'source': source, 'target': nbd_drv}) continue - fname = dirs[dst] + '/test-target' - if args.compressed: - fname += '.qcow2' - target = drv_file(fname) - if args.compressed: - target = drv_qcow2(target) - test_cases.append({'id': t, 'source': source, 'target': target}) + if args.target_cache == 'both': + target_caches = ['direct', 'cached'] + else: + target_caches = [args.target_cache] + + for c in target_caches: + o_direct = c == 'direct' + fname = dirs[dst] + '/test-target' + if args.compressed: + fname += '.qcow2' + target = drv_file(fname, o_direct=o_direct) + if args.compressed: + target = drv_qcow2(target) + + test_id = t + if args.target_cache == 'both': + test_id += f'({c})' + + test_cases.append({'id': test_id, 'source': source, + 'target': target}) binaries = [] # list of (