-
Notifications
You must be signed in to change notification settings - Fork 1
/
performance_stats.py
60 lines (53 loc) · 1.52 KB
/
performance_stats.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
60
#/usr/bin/python
# coding=utf-8
import subprocess
import pickle
import os
data = [(0,0,0,0,0)]
for i in range(10,11,10):
enc_time = 0.0
M_time = 0.0
inter_dec_time = 0.0
alice_dec_time = 0.0
bob_dec_time = 0.0
inner_time = 0.0
trans_time = 0.0
dec_time =0.0
os.chdir('alice')
process = subprocess.Popen('./alice '+str(i)+" "+str(200), \
shell= True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out,err = process.communicate()
time = [float(ele)for ele in out.split()]
enc_time += time[0]
M_time += time[1] + time[2]
os.chdir('../bob')
process = subprocess.Popen('./bob '+str(i)+" "+str(200), \
shell= True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out,err = process.communicate()
time = [float(ele)for ele in out.split()]
enc_time += time[0]
M_time += time[1] + time[2]
os.chdir('../cloud')
process = subprocess.Popen('./cloud '+str(3)+" "+str(i), \
shell= True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out,err = process.communicate()
time = [float(ele)for ele in out.split()]
M_time += time[0]
inter_dec_time += time[1]
dec_time += time[2]
alice_dec_time += time[3]
dec_time += time[4]
bob_dec_time += time[5]
dec_time += time[6]
#print i, " cnt: ", time[4], time[5], time[6]
'''
inner_time += time[1]
trans_time += time[2]
dec_time += time[3]
'''
os.chdir('..')
#data.append((enc_time,M_time,inter_dec_time,alice_dec_time,bob_dec_time))
data.append((enc_time,M_time,inter_dec_time,alice_dec_time,bob_dec_time,dec_time))
print data
file = open("results",'w')
pickle.dump(data,file)