5 # Copyright (c) 2019 Virtuozzo International GmbH.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 from results_to_text
import results_to_text
23 from bench_block_job
import bench_block_copy
, drv_file
, drv_nbd
26 def bench_func(env
, case
):
27 """ Handle one "cell" of benchmarking table. """
28 return bench_block_copy(env
['qemu_binary'], env
['cmd'], {},
29 case
['source'], case
['target'])
32 # You may set the following five variables to correct values, to turn this
33 # example to real benchmark.
34 ssd_source
= '/path-to-raw-source-image-at-ssd'
35 ssd_target
= '/path-to-raw-target-image-at-ssd'
36 hdd_target
= '/path-to-raw-source-image-at-hdd'
37 nbd_ip
= 'nbd-ip-addr'
38 nbd_port
= 'nbd-port-number'
40 # Test-cases are "rows" in benchmark resulting table, 'id' is a caption for
41 # the row, other fields are handled by bench_func.
45 'source': drv_file(ssd_source
),
46 'target': drv_file(ssd_target
)
50 'source': drv_file(ssd_source
),
51 'target': drv_file(hdd_target
)
55 'source': drv_file(ssd_source
),
56 'target': drv_nbd(nbd_ip
, nbd_port
)
60 # Test-envs are "columns" in benchmark resulting table, 'id is a caption for
61 # the column, other fields are handled by bench_func.
65 'cmd': 'blockdev-backup',
66 'qemu_binary': '/path-to-qemu-binary-1'
70 'cmd': 'blockdev-backup',
71 'qemu_binary': '/path-to-qemu-binary-2'
75 'cmd': 'blockdev-mirror',
76 'qemu_binary': '/path-to-qemu-binary-1'
80 result
= simplebench
.bench(bench_func
, test_envs
, test_cases
, count
=3)
81 print(results_to_text(result
))