-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcalculate_collisions.py
executable file
·52 lines (44 loc) · 1.28 KB
/
calculate_collisions.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
#!/usr/bin/env python
from pwn import *
context.log_level='error'
table_size=190
step_size=10
N=10**5
table_max=600+1
total_col=[]
for i in xrange(table_size,table_max,step_size):
r=process(['./parallel.out',str(N),str(i)])
print "Table Size =",i
output=r.recvall().split('\n')
cols=[]
p_done=False
for k in output:
for line in output:
if("left out" in line):
cols.append(float(line.split()[-1]))
if("Success" in line):
p_done=True
cols.append(0)
p=sum(cols)//len(cols)
r.kill()
# r=process(['./sequential.out', str(N),str(i)])
# output=r.recvall().split('\n')
# cols=[]
# s_done=False
# for k in output:
# for line in output:
# if("left out" in line):
# cols.append(float(line.split()[-1]))
# if("Success" in line):
# s_done=True
# s=sum(cols)/float(len(cols))
# r.kill()
# total_times.append([i,p,s,p_done,s_done])
total_col.append([i,p,p_done])
for t in total_col:
print t
with open('observations/collisions_%d.csv' %(step_size), 'w') as f:
f.write('Table Size\tCollisions\tDone\n')
for t in total_col:
i,p,p_done=t
f.write("%d\t%d\t%d\n" %(i,p,p_done))