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