OLD | NEW |
1 import time, os, signal, re | 1 import time, os, signal, re |
2 from autotest_lib.client.bin import test, utils | 2 from autotest_lib.client.bin import test, utils |
3 | 3 |
4 | 4 |
5 class tbench(test.test): | 5 class tbench(test.test): |
6 version = 2 | 6 version = 2 |
7 | 7 |
8 def initialize(self): | 8 def initialize(self): |
9 self.job.require_gcc() | 9 self.job.require_gcc() |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 if not nprocs: | 25 if not nprocs: |
26 nprocs = self.job.cpu_count() | 26 nprocs = self.job.cpu_count() |
27 args = args + ' %s' % nprocs | 27 args = args + ' %s' % nprocs |
28 | 28 |
29 pid = os.fork() | 29 pid = os.fork() |
30 if pid: # parent | 30 if pid: # parent |
31 time.sleep(1) | 31 time.sleep(1) |
32 client = self.srcdir + '/client.txt' | 32 client = self.srcdir + '/client.txt' |
33 args = '-c ' + client + ' ' + '%s' % args | 33 args = '-c ' + client + ' ' + '%s' % args |
34 cmd = os.path.join(self.srcdir, "tbench") + " " + args | 34 cmd = os.path.join(self.srcdir, "tbench") + " " + args |
35 self.results = utils.system_output(cmd, retain_output=True) | 35 # Standard output is verbose and merely makes our debug logs huge |
| 36 # so we don't retain it. It gets parsed for the results. |
| 37 self.results = utils.run(cmd, stderr_tee=utils.TEE_TO_LOGS).stdout |
36 os.kill(pid, signal.SIGTERM) # clean up the server | 38 os.kill(pid, signal.SIGTERM) # clean up the server |
37 else: # child | 39 else: # child |
38 server = self.srcdir + '/tbench_srv' | 40 server = self.srcdir + '/tbench_srv' |
39 os.execlp(server, server) | 41 os.execlp(server, server) |
40 | 42 |
41 | 43 |
42 def postprocess_iteration(self): | 44 def postprocess_iteration(self): |
43 pattern = re.compile(r"Throughput (.*?) MB/sec (.*?) procs") | 45 pattern = re.compile(r"Throughput (.*?) MB/sec (.*?) procs") |
44 (throughput, procs) = pattern.findall(self.results)[0] | 46 (throughput, procs) = pattern.findall(self.results)[0] |
45 self.write_perf_keyval({'throughput':throughput, 'procs':procs}) | 47 self.write_perf_keyval({'throughput':throughput, 'procs':procs}) |
OLD | NEW |