blob: f99c81648c26fff6282c25a72017aa4a1e9ef840 [file] [log] [blame]
koder aka kdanilov6e2ae792015-03-04 18:02:24 -08001# BLOCK_SIZES = "1k 4k 64k 256k 1m"
2# OPERATIONS="randwrite write randread read"
3# SYNC_TYPES="s a d"
4# REPEAT_COUNT="3"
5# CONCURRENCES="1 8 64"
6
7from utils import ssize_to_kb
8
9SYNC_FACTOR = "x500"
10DIRECT_FACTOR = "x10000"
11ASYNC_FACTOR = "r2"
12
13
14def make_list(x):
15 if not isinstance(x, (list, tuple)):
16 return [x]
17 return x
18
19HDD_SIZE_KB = 45 * 1000 * 1000
20
21
koder aka kdanilovce5444f2015-03-14 09:19:02 +020022def max_file():
23 pass
24
25
koder aka kdanilov6e2ae792015-03-04 18:02:24 -080026def make_load(sizes, opers, sync_types, concurrence,
27 tester_type='iozone', repeat_count=3):
28
29 iodepth = 1
30 for conc in make_list(concurrence):
31 for bsize in make_list(sizes):
32 for oper in make_list(opers):
33 for sync_type in make_list(sync_types):
34
35 # filter out too slow options
36 if bsize in "1k 4k" and sync_type == "a":
37 continue
38
39 # filter out sync reads
40 if oper in "read randread" and sync_type == "s":
41 continue
42
43 if sync_type == "s":
44 size_sync_opts = "--iosize {0} -s".format(SYNC_FACTOR)
45 elif sync_type == "d":
46 if oper == 'randread':
47 assert SYNC_FACTOR[0] == 'x'
48 max_f = int(SYNC_FACTOR[1:])
49 else:
50 max_f = None
51
52 mmax_f = HDD_SIZE_KB / (int(conc) * ssize_to_kb(bsize))
53
54 if max_f is None or mmax_f > max_f:
55 max_f = mmax_f
56
57 assert DIRECT_FACTOR[0] == 'x'
58 if max_f > int(DIRECT_FACTOR[1:]):
59 max_f = DIRECT_FACTOR
60 else:
61 max_f = "x{0}".format(max_f)
62
63 size_sync_opts = "--iosize {0} -d".format(max_f)
64
65 else:
koder aka kdanilovce5444f2015-03-14 09:19:02 +020066 if oper == 'randread' or oper == 'read':
67 size_sync_opts = "--iosize " + str(SYNC_FACTOR)
68 else:
69 size_sync_opts = "--iosize " + str(ASYNC_FACTOR)
koder aka kdanilov6e2ae792015-03-04 18:02:24 -080070
71 # size_sync_opts = get_file_size_opts(sync_type)
72
73 io_opts = "--type {0} ".format(tester_type)
74 io_opts += "-a {0} ".format(oper)
75 io_opts += "--iodepth {0} ".format(iodepth)
76 io_opts += "--blocksize {0} ".format(bsize)
77 io_opts += size_sync_opts + " "
78 io_opts += "--concurrency {0}".format(conc)
79
80 for i in range(repeat_count):
81 yield io_opts
82
83
84sizes = "4k 64k 2m".split()
85opers = "randwrite write randread read".split()
86sync_types = "s a d".split()
87concurrence = "1 8 64".split()
88
89for io_opts in make_load(sizes=sizes, concurrence=concurrence,
90 sync_types=sync_types, opers=opers):
91 print io_opts