source: PlatformSupport/matperf/server/serverudptradeoff

Last change on this file was 951, checked in by chunter, 16 years ago

adding matperf

  • Property svn:executable set to *
File size: 4.2 KB
Line 
1# this is a python script that parse the tradeoff output into a vector of words to be used later.
2
3import re
4result = open('result.txt').readlines()
5length1 = len(result)
6
7# it is the same process as serverudpsingle in the below box.
8###############################################
9for i in range(0, length1):
10        result[i] = result[i].replace('- ', '-')
11        result[i] = result[i].replace('/ ', '/')
12        result[i] = result[i].replace('[','[ ')
13        result[i] = result[i].replace(']',' ]')
14        result[i] = result[i].replace(':',' :')
15        result[i] = result[i].replace('(','( ')
16        result[i] = result[i].replace(')',' )')
17for i in range(0, length1):
18        result[i] = result[i].replace('-', ' ')
19        result[i] = result[i].replace('/', ' ')
20
21###############################################
22b = result[1:4];
23for i in range(0, len(b)):
24    buffer = b[i]
25    r = re.split('\s+',str(buffer))
26    for j in range(0,len(r)):
27        s = open('buffer.txt','a')
28        s.write(str(r[j])+'\n')
29        s.close()
30
31a = result[9:11];
32for i in range(0, len(a)):
33    buffer = a[i]
34    r = re.split('\s+',str(buffer))
35    for j in range(0,len(r)):
36        s = open('tradeoff_buffer.txt','a')
37        s.write(str(r[j])+'\n')
38        s.close()
39
40#############################################################################################################################################################
41# I checked the size or the length of the specific line. It is the line sometimes contains either 'Transfer Bandwidth Window'
42# or 'Transfer Bandwidth Jitter Loss Totalpacket'. Their size was different. If the size was small(line 12), the line(either 16 or 17) that contain
43# what we need should be located in the different place. Also I had to check that different line whether it contains what we need. I checked the specific
44# word 'server' and if it was not found, that line was defined to be the line we need. and if the word was found, the line we need was defined to be the line
45# above the line where the word was found.
46#############################################################################################################################################################
47
48start = 0
49end = 19
50if(len(result[18]) >60):
51    j = 19
52elif(len(result[18]) < 60):
53    j= 15
54
55### the remainder from division of i and 20 (the number of lines) is the line where the information is stored.
56
57for i in range(start, end+1):
58    if (i%20) == 5:
59        f = open('ptmp.txt','a')
60        f.write(str(result[i])+'\n')
61        f.close()
62    elif (i%20) == 13:
63        f = open('tradeoff_ptmp.txt','a')
64        f.write(str(result[i])+'\n')
65        f.close()
66    elif (i%20) == 7:
67        f = open('rtmp.txt','a')
68        f.write(str(result[i])+ '\n')
69        f.close()
70    elif (i%20) == j:
71        f = open('tradeoff_rtmp.txt','a')
72        f.write(str(result[i])+ '\n')
73        f.close()
74
75
76##############################################################################
77# from this line, python separates the sentence into words and store the words
78# into a vector. Matlab deals with vectors better and it makes
79# the matlab users very convenient.
80###############################################################################
81
82a = open('ptmp.txt').readlines()
83for i in range(0, len(a)):
84    portadd = a[i]
85    q = re.split('\s+', str(portadd))
86    for j in range(0, len(q)):
87        s = open('portadd.txt','a')
88        s.write(str(q[j])+'\n')
89        s.close()
90
91f = open('rtmp.txt').readlines()
92for i in range(0, len(f)):
93    repnum = f[i]
94    p = re.split('\s+', str(repnum))
95    for j in range(0, len(p)):
96        s = open('repnum.txt','a')
97        s.write(str(p[j])+'\n')
98        s.close()
99
100
101f = open('tradeoff_rtmp.txt').readlines()
102for i in range(0, len(f)):
103    d_repnum = f[i]
104    p = re.split('\s+', str(d_repnum))
105    for j in range(0, len(p)):
106        s = open('tradeoff_repnum.txt','a')
107        s.write(str(p[j])+'\n')
108        s.close()
109
110a = open('tradeoff_ptmp.txt').readlines()
111for i in range(0, len(a)):
112    d_portadd = a[i]
113    q = re.split('\s+', str(d_portadd))
114    for j in range(0, len(  q)):
115        s = open('tradeoff_portadd.txt','a')
116        s.write(str(q[j])+'\n')
117        s.close()
Note: See TracBrowser for help on using the repository browser.