mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 10:15:57 +01:00
start moving algorithm in
This commit is contained in:
30
userland/algorithm/set/generate_io
Executable file
30
userland/algorithm/set/generate_io
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import random
|
||||
import sys
|
||||
import os
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))))
|
||||
import common
|
||||
|
||||
# Handle CLI arguments.
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--min', type=int, default=0)
|
||||
parser.add_argument('--max', type=int, default=(2**32 - 1))
|
||||
parser.add_argument('--seed', type=int)
|
||||
parser.add_argument('--size', type=int, default=1000000)
|
||||
parser.add_argument('--unique', type=bool, default=True,
|
||||
help='if True, remove duplicates from the expected output')
|
||||
args = parser.parse_args()
|
||||
random.seed(args.seed)
|
||||
input_data = common.LkmcList()
|
||||
for i in range(args.size):
|
||||
input_data.append(random.randint(args.min, args.max))
|
||||
with open('tmp.i', 'w') as i:
|
||||
i.write(str(input_data) + '\n')
|
||||
if args.unique:
|
||||
input_data = common.LkmcList(set(input_data))
|
||||
input_data.sort()
|
||||
with open('tmp.e', 'w') as e:
|
||||
e.write(str(input_data) + '\n')
|
||||
Reference in New Issue
Block a user