blob: 096da3bb184a236ba20a3cfa9ed1f2347616f820 [file] [log] [blame]
gstepanov993c74b2015-02-05 15:20:38 +02001import os
koder aka kdanilov4a72f122015-02-09 12:25:54 +02002import sys
koder aka kdanilov3cbbc9d2015-02-04 15:37:58 +02003import uuid
4import random
5import itertools
6
7from petname import Generate as pet_generate
koder aka kdanilov4a72f122015-02-09 12:25:54 +02008from storage_api import create_storage
koder aka kdanilov3cbbc9d2015-02-04 15:37:58 +02009
Yulia Portnova929dbe82015-02-06 12:49:54 +020010from report import ssize_to_kb
koder aka kdanilov3cbbc9d2015-02-04 15:37:58 +020011
koder aka kdanilov98385d82015-02-04 17:09:28 +020012types = ["GA", "master"] + [pet_generate(2, '-') for _ in range(2)]
koder aka kdanilov3cbbc9d2015-02-04 15:37:58 +020013random.shuffle(types)
14tp = itertools.cycle(types)
15
koder aka kdanilov4a72f122015-02-09 12:25:54 +020016sz = ["1k", "4k", "64k", "256k", "1m"]
koder aka kdanilov3cbbc9d2015-02-04 15:37:58 +020017op_type = ["randread", "read", "randwrite", "write"]
18is_sync = ["s", "a"]
19
koder aka kdanilov4a72f122015-02-09 12:25:54 +020020storage = create_storage(sys.argv[1], "", "")
koder aka kdanilov98385d82015-02-04 17:09:28 +020021combinations = list(itertools.product(op_type, is_sync, sz))
koder aka kdanilov3cbbc9d2015-02-04 15:37:58 +020022
23for i in range(30):
24 row = {"build_id": pet_generate(2, " "),
25 "type": next(tp),
26 "iso_md5": uuid.uuid4().get_hex()}
27
Yulia Portnova929dbe82015-02-06 12:49:54 +020028 for op_type, is_sync, sz in combinations:
29 ((random.random() - 0.5) * 0.2 + 1)
30 row[" ".join([op_type, is_sync, sz])] = (
31 ((random.random() - 0.5) * 0.2 + 1) * (ssize_to_kb(sz) ** 0.5),
32 ((random.random() - 0.5) * 0.2 + 1) * (ssize_to_kb(sz) ** 0.5) * 0.15)
koder aka kdanilov3cbbc9d2015-02-04 15:37:58 +020033
gstepanov993c74b2015-02-05 15:20:38 +020034 print len(row)
koder aka kdanilov3cbbc9d2015-02-04 15:37:58 +020035 storage.store(row)