OLD | NEW |
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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 cmd = 'taskset %s %s' % (cpu_affinity, cmd) | 166 cmd = 'taskset %s %s' % (cpu_affinity, cmd) |
167 | 167 |
168 try: | 168 try: |
169 cmds = [] | 169 cmds = [] |
170 | 170 |
171 # Get 5 mpstat samples. Since tests with large number of streams | 171 # Get 5 mpstat samples. Since tests with large number of streams |
172 # take a long time to start up all the streams, we'll toss out the | 172 # take a long time to start up all the streams, we'll toss out the |
173 # first and last sample when recording results | 173 # first and last sample when recording results |
174 interval = max(1, test_time / 5) | 174 interval = max(1, test_time / 5) |
175 cmds.append('sleep %d && %s -P ALL %s 5' % (self.wait_time, mpstat, | 175 cmds.append('sleep %d && %s -P ALL %s 5' % (self.wait_time, mpstat, |
176 interval)) | 176 interval)) |
177 | 177 |
178 # Add the netperf commands | 178 # Add the netperf commands |
179 for i in xrange(num_streams): | 179 for i in xrange(num_streams): |
180 cmds.append(cmd) | 180 cmds.append(cmd) |
181 if self.bidi and test == 'TCP_STREAM': | 181 if self.bidi and test == 'TCP_STREAM': |
182 cmds.append(cmd.replace('TCP_STREAM', 'TCP_MAERTS')) | 182 cmds.append(cmd.replace('TCP_STREAM', 'TCP_MAERTS')) |
183 | 183 |
184 t0 = time.time() | 184 t0 = time.time() |
185 # Launch all commands in parallel | 185 # Launch all commands in parallel |
186 out = utils.run_parallel(cmds, timeout=test_time + 500, | 186 out = utils.run_parallel(cmds, timeout=test_time + 500, |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 end_time = curr_time + timeout | 341 end_time = curr_time + timeout |
342 while curr_time < end_time: | 342 while curr_time < end_time: |
343 if not os.system('ping -c 1 ' + ip): | 343 if not os.system('ping -c 1 ' + ip): |
344 # Ping succeeded | 344 # Ping succeeded |
345 return | 345 return |
346 # Ping failed. Lets sleep a bit and try again. | 346 # Ping failed. Lets sleep a bit and try again. |
347 time.sleep(5) | 347 time.sleep(5) |
348 curr_time = time.time() | 348 curr_time = time.time() |
349 | 349 |
350 return | 350 return |
OLD | NEW |