-
Notifications
You must be signed in to change notification settings - Fork 1
/
Test2.py
61 lines (54 loc) · 1.53 KB
/
Test2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
from probe import launcher
import random
import os
def generate(inputs):
for key in inputs:
case = inputs[key]
size= case[0]
name = case[1]
cmd = "cd rule;sh generator.sh "+name+" "+str(size)
print cmd
os.system(cmd)
if __name__ == "__main__":
import sys
if len(sys.argv) != 2:
print "Usage: python Test.py Mode [fault|non-adapt|full-adapt|semi-adapt]"
exit(1)
mode = sys.argv[1]
if not mode in ["fault","non-adapt","full-adapt","semi-adapt"]:
exit(1)
step = 10;
inputs = {}
for i in range(0,step):
inputs[i] = [10,str(i)]
for i in range(step,2*step):
inputs[i] = [100,str(i)]
#for i in range(2*step,3*step):
# inputs[i] = [1000,str(i)]
#for i in range(3*step,4*step):
# inputs[i] = [10000,str(i)]
#generate(inputs)
total = 0
right = 0
time = {}
time[0] = 0
time[1] = 0
time[2] = 0
for key in inputs:
case = inputs[key]
size= case[0]
name = case[1]
print "case: ",case
if mode == "fault":
ret = launcher.launcherAWithWrongTable("./data/"+name,"./data/"+name+".miss")
elif mode == "full-adapt":
ret = launcher.launcherCWithWrongTable("./data/"+name,"./data/"+name+".order")
if ret[0] == True:
right += 1
total += 1
time[key/step] += ret[1]
print right,"/",total
for i in range(0,3):
print i,time[i],
if step > 0:
print time[i]/step