Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Side by Side Diff: client/tests/netperf2/netperf2.py

Issue 669113: This will fix the build issues for sysstat, as we don't need to install. (Closed)
Patch Set: Added change to netperf2 since we are no longer installing sysstat. Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « client/deps/sysstat/sysstat.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import os, time, re, logging 1 import os, time, re, logging
2 from autotest_lib.client.bin import test, utils 2 from autotest_lib.client.bin import test, utils
3 from autotest_lib.client.bin.net import net_utils 3 from autotest_lib.client.bin.net import net_utils
4 from autotest_lib.client.common_lib import error 4 from autotest_lib.client.common_lib import error
5 5
6 MPSTAT_IX = 0 6 MPSTAT_IX = 0
7 NETPERF_IX = 1 7 NETPERF_IX = 1
8 8
9 class netperf2(test.test): 9 class netperf2(test.test):
10 version = 4 10 version = 4
(...skipping 21 matching lines...) Expand all
32 self.server_prog = '%s&' % os.path.join(self.srcdir, 'src/netserver') 32 self.server_prog = '%s&' % os.path.join(self.srcdir, 'src/netserver')
33 self.client_prog = '%s' % os.path.join(self.srcdir, 'src/netperf') 33 self.client_prog = '%s' % os.path.join(self.srcdir, 'src/netperf')
34 self.valid_tests = ['TCP_STREAM', 'TCP_MAERTS', 'TCP_RR', 'TCP_CRR', 34 self.valid_tests = ['TCP_STREAM', 'TCP_MAERTS', 'TCP_RR', 'TCP_CRR',
35 'TCP_SENDFILE', 'UDP_STREAM', 'UDP_RR'] 35 'TCP_SENDFILE', 'UDP_STREAM', 'UDP_RR']
36 self.results = [] 36 self.results = []
37 self.actual_times = [] 37 self.actual_times = []
38 self.netif = '' 38 self.netif = ''
39 self.network = net_utils.network() 39 self.network = net_utils.network()
40 self.network_utils = net_utils.network_utils() 40 self.network_utils = net_utils.network_utils()
41 41
42 dep = 'sysstat'
43 dep_dir = os.path.join(self.autodir, 'deps', dep)
ericli 2010/03/05 22:20:39 This is duplicated with line 28.
kdlucas 2010/03/05 23:24:44 So I think what is happening here is after we comp
44 self.job.install_pkg(dep, 'dep', dep_dir)
45
42 46
43 def run_once(self, server_ip, client_ip, role, test = 'TCP_STREAM', 47 def run_once(self, server_ip, client_ip, role, test = 'TCP_STREAM',
44 test_time = 15, stream_list = [1], test_specific_args = '', 48 test_time = 15, stream_list = [1], test_specific_args = '',
45 cpu_affinity = '', dev = '', bidi = False, wait_time = 5): 49 cpu_affinity = '', dev = '', bidi = False, wait_time = 5):
46 """ 50 """
47 server_ip: IP address of host running netserver 51 server_ip: IP address of host running netserver
48 client_ip: IP address of host running netperf client(s) 52 client_ip: IP address of host running netperf client(s)
49 role: 'client' or 'server' 53 role: 'client' or 'server'
50 test: one of TCP_STREAM, TCP_MEARTS, TCP_RR, TCP_CRR, TCP_SENDFILE, 54 test: one of TCP_STREAM, TCP_MEARTS, TCP_RR, TCP_CRR, TCP_SENDFILE,
51 UDP_STREAM or UDP_RR 55 UDP_STREAM or UDP_RR
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 145
142 146
143 def server_stop(self): 147 def server_stop(self):
144 utils.system('killall netserver', ignore_status=True) 148 utils.system('killall netserver', ignore_status=True)
145 149
146 150
147 def client(self, server_ip, test, test_time, num_streams, 151 def client(self, server_ip, test, test_time, num_streams,
148 test_specific_args, cpu_affinity): 152 test_specific_args, cpu_affinity):
149 args = '-H %s -t %s -l %d' % (server_ip, test, test_time) 153 args = '-H %s -t %s -l %d' % (server_ip, test, test_time)
150 154
151 mpstat = os.path.join(self.autodir + 'deps/sysstat/mpstat') 155 if os.path.exists('/usr/bin/mpstat'):
156 mpstat = '/usr/bin/mpstat'
157 else:
158 mpstat = os.path.join(self.autodir + '/deps/sysstat/src/mpstat')
152 159
153 if self.wait_time: 160 if self.wait_time:
154 args += ' -s %d ' % self.wait_time 161 args += ' -s %d ' % self.wait_time
155 162
156 # Append the test specific arguments. 163 # Append the test specific arguments.
157 if test_specific_args: 164 if test_specific_args:
158 args += ' ' + test_specific_args 165 args += ' ' + test_specific_args
159 166
160 cmd = '%s %s' % (self.client_prog, args) 167 cmd = '%s %s' % (self.client_prog, args)
161 168
162 if cpu_affinity: 169 if cpu_affinity:
163 cmd = 'taskset %s %s' % (cpu_affinity, cmd) 170 cmd = 'taskset %s %s' % (cpu_affinity, cmd)
164 171
165 try: 172 try:
166 cmds = [] 173 cmds = []
167 174
168 # Get 5 mpstat samples. Since tests with large number of streams 175 # Get 5 mpstat samples. Since tests with large number of streams
169 # take a long time to start up all the streams, we'll toss out the 176 # take a long time to start up all the streams, we'll toss out the
170 # first and last sample when recording results 177 # first and last sample when recording results
171 interval = max(1, test_time / 5) 178 interval = max(1, test_time / 5)
172 cmds.append('sleep %d && mpstat -P ALL %s 5' % (self.wait_time, 179 cmds.append('sleep %d && %s -P ALL %s 5' % (self.wait_time, mpstat,
173 interval)) 180 interval))
174 181
175 # Add the netperf commands 182 # Add the netperf commands
176 for i in xrange(num_streams): 183 for i in xrange(num_streams):
177 cmds.append(cmd) 184 cmds.append(cmd)
178 if self.bidi and test == 'TCP_STREAM': 185 if self.bidi and test == 'TCP_STREAM':
179 cmds.append(cmd.replace('TCP_STREAM', 'TCP_MAERTS')) 186 cmds.append(cmd.replace('TCP_STREAM', 'TCP_MAERTS'))
180 187
181 t0 = time.time() 188 t0 = time.time()
182 # Launch all commands in parallel 189 # Launch all commands in parallel
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 end_time = curr_time + timeout 345 end_time = curr_time + timeout
339 while curr_time < end_time: 346 while curr_time < end_time:
340 if not os.system('ping -c 1 ' + ip): 347 if not os.system('ping -c 1 ' + ip):
341 # Ping succeeded 348 # Ping succeeded
342 return 349 return
343 # Ping failed. Lets sleep a bit and try again. 350 # Ping failed. Lets sleep a bit and try again.
344 time.sleep(5) 351 time.sleep(5)
345 curr_time = time.time() 352 curr_time = time.time()
346 353
347 return 354 return
OLDNEW
« no previous file with comments | « client/deps/sysstat/sysstat.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698