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

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

Issue 3554003: Merge remote branch 'cros/upstream' into tempbranch3 (Closed) Base URL: http://git.chromium.org/git/autotest.git
Patch Set: Created 10 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « client/tests/systemtap/systemtap.py ('k') | client/tests/tsc/tsc.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 11
12 # http://samba.org/ftp/tridge/dbench/dbench-3.04.tar.gz 12 # http://samba.org/ftp/tridge/dbench/dbench-3.04.tar.gz
13 def setup(self, tarball = 'dbench-3.04.tar.gz'): 13 def setup(self, tarball = 'dbench-3.04.tar.gz'):
14 tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir) 14 tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir)
15 utils.extract_tarball_to_dir(tarball, self.srcdir) 15 utils.extract_tarball_to_dir(tarball, self.srcdir)
16 os.chdir(self.srcdir) 16 os.chdir(self.srcdir)
17 17
18 utils.system('./configure') 18 utils.configure()
19 utils.system('make') 19 utils.make()
20 20
21 21
22 def run_once(self, nprocs = None, args = ''): 22 def run_once(self, nprocs = None, args = ''):
23 # only supports combined server+client model at the moment 23 # only supports combined server+client model at the moment
24 # should support separate I suppose, but nobody uses it 24 # should support separate I suppose, but nobody uses it
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 self.results = utils.system_output(cmd, retain_output=True)
36 os.kill(pid, signal.SIGTERM) # clean up the server 36 os.kill(pid, signal.SIGTERM) # clean up the server
37 else: # child 37 else: # child
38 server = self.srcdir + '/tbench_srv' 38 server = self.srcdir + '/tbench_srv'
39 os.execlp(server, server) 39 os.execlp(server, server)
40 40
41 41
42 def postprocess_iteration(self): 42 def postprocess_iteration(self):
43 pattern = re.compile(r"Throughput (.*?) MB/sec (.*?) procs") 43 pattern = re.compile(r"Throughput (.*?) MB/sec (.*?) procs")
44 (throughput, procs) = pattern.findall(self.results)[0] 44 (throughput, procs) = pattern.findall(self.results)[0]
45 self.write_perf_keyval({'throughput':throughput, 'procs':procs}) 45 self.write_perf_keyval({'throughput':throughput, 'procs':procs})
OLDNEW
« no previous file with comments | « client/tests/systemtap/systemtap.py ('k') | client/tests/tsc/tsc.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698