File size: 1,068 Bytes
167f5d0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import numpy as np

with open("record_sent.txt","r") as f:
    sent = f.readlines()
with open("record_recv.txt","r") as f:
    recv = f.readlines()

# sent[id] = time from first sent
sent = np.array([ float(item[5:14]) for item in sent ])

# recv[i][j] for each j
# j=0 -> 0 for online and 1 for offline
# j=1 -> start id
# j=2 -> end id
# j=3 -> time from first sent
recv = [[int(item[0]), int(item[2:6]), int(item[7:11]), float(item[12:21])] for item in recv]

online_time = []
offline_time = []
alltime = []

for item in recv:
    proc_time = item[3] - sent[item[2]]
    if item[0] == 1:
        # offline
        offline_time.append(proc_time)
    else:
        # online
        online_time.append(proc_time)
    alltime.append(proc_time)

print("online  time avg: "+format(np.mean(online_time),'6.3f')+", std = "+format(np.std(online_time),'6.3f'))
print("offline time avg: "+format(np.mean(offline_time),'6.3f')+", std = "+format(np.std(offline_time),'6.3f'))
print("allline time avg: "+format(np.mean(alltime),'6.3f')+", std = "+format(np.std(alltime),'6.3f'))