| # BLOCK_SIZES = "1k 4k 64k 256k 1m" |
| # OPERATIONS="randwrite write randread read" |
| # SYNC_TYPES="s a d" |
| # REPEAT_COUNT="3" |
| # CONCURRENCES="1 8 64" |
| |
| from utils import ssize_to_kb |
| |
| SYNC_FACTOR = "x500" |
| DIRECT_FACTOR = "x10000" |
| ASYNC_FACTOR = "r2" |
| |
| |
| def make_list(x): |
| if not isinstance(x, (list, tuple)): |
| return [x] |
| return x |
| |
| HDD_SIZE_KB = 45 * 1000 * 1000 |
| |
| |
| def max_file(): |
| pass |
| |
| |
| def make_load(sizes, opers, sync_types, concurrence, |
| tester_type='iozone', repeat_count=3): |
| |
| iodepth = 1 |
| for conc in make_list(concurrence): |
| for bsize in make_list(sizes): |
| for oper in make_list(opers): |
| for sync_type in make_list(sync_types): |
| |
| # filter out too slow options |
| if bsize in "1k 4k" and sync_type == "a": |
| continue |
| |
| # filter out sync reads |
| if oper in "read randread" and sync_type == "s": |
| continue |
| |
| if sync_type == "s": |
| size_sync_opts = "--iosize {0} -s".format(SYNC_FACTOR) |
| elif sync_type == "d": |
| if oper == 'randread': |
| assert SYNC_FACTOR[0] == 'x' |
| max_f = int(SYNC_FACTOR[1:]) |
| else: |
| max_f = None |
| |
| mmax_f = HDD_SIZE_KB / (int(conc) * ssize_to_kb(bsize)) |
| |
| if max_f is None or mmax_f > max_f: |
| max_f = mmax_f |
| |
| assert DIRECT_FACTOR[0] == 'x' |
| if max_f > int(DIRECT_FACTOR[1:]): |
| max_f = DIRECT_FACTOR |
| else: |
| max_f = "x{0}".format(max_f) |
| |
| size_sync_opts = "--iosize {0} -d".format(max_f) |
| |
| else: |
| if oper == 'randread' or oper == 'read': |
| size_sync_opts = "--iosize " + str(SYNC_FACTOR) |
| else: |
| size_sync_opts = "--iosize " + str(ASYNC_FACTOR) |
| |
| # size_sync_opts = get_file_size_opts(sync_type) |
| |
| io_opts = "--type {0} ".format(tester_type) |
| io_opts += "-a {0} ".format(oper) |
| io_opts += "--iodepth {0} ".format(iodepth) |
| io_opts += "--blocksize {0} ".format(bsize) |
| io_opts += size_sync_opts + " " |
| io_opts += "--concurrency {0}".format(conc) |
| |
| for i in range(repeat_count): |
| yield io_opts |
| |
| |
| sizes = "4k 64k 2m".split() |
| opers = "randwrite write randread read".split() |
| sync_types = "s a d".split() |
| concurrence = "1 8 64".split() |
| |
| for io_opts in make_load(sizes=sizes, concurrence=concurrence, |
| sync_types=sync_types, opers=opers): |
| print io_opts |