forked from mininet/mininet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tcptracer_throughput_plot.py
executable file
·41 lines (35 loc) · 1.06 KB
/
tcptracer_throughput_plot.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
#!/usr/bin/python
import re
fileName= "tt_tghr.dat"
f = open(fileName, "r");
packet_rates = []
throughputs = []
while (True):
line = f.readline()
if not line:
break
regx = re.compile('--rate[ ]*[=]?[ ]*[0-9]+')
regx2 = re.compile('--rate[ ]*[=]?[ ]*')
packet_rate = int(regx2.sub('',''.join(regx.findall(line))))
packet_rates.append(packet_rate)
line = f.readline()
regx = re.compile('throughput:[ ]+[0-9]+ Bps')
regx2 = re.compile('[^0-9]+')
throughput = 0
throughput += int(regx2.sub('',regx.findall(line)[0]))
line = f.readline()
regx = re.compile('throughput:[ ]+[0-9]+ Bps')
regx2 = re.compile('[^0-9]+')
throughput += int(regx2.sub('',regx.findall(line)[0]))
line = f.readline()
regx = re.compile('throughput:[ ]+[0-9]+ Bps')
regx2 = re.compile('[^0-9]+')
throughput += int(regx2.sub('',regx.findall(line)[0]))
line = f.readline()
regx = re.compile('throughput:[ ]+[0-9]+ Bps')
regx2 = re.compile('[^0-9]+')
throughput += int(regx2.sub('',regx.findall(line)[0]))
throughputs.append(throughput)
f.close()
print packet_rates
print throughputs