blob: 61323c26e029d1a5df267a89532e7d108d33b0af [file] [log] [blame]
mbligh51fca2c2008-10-10 21:08:59 +00001import os
mbligh53da18e2009-01-05 21:13:26 +00002from autotest_lib.client.bin import test, utils
mbligh51fca2c2008-10-10 21:08:59 +00003
4
5class hackbench(test.test):
6 version = 1
7 preserve_srcdir = True
8
9
10 def setup(self):
11 os.chdir(self.srcdir)
12 utils.system('cc -lpthread hackbench.c -o hackbench')
13
14
15 def initialize(self):
16 self.job.require_gcc()
17 self.results = []
18
19
20 def run_once(self, num_groups=90):
21 hackbench_bin = os.path.join(self.srcdir, 'hackbench')
22 cmd = '%s %s' % (hackbench_bin, num_groups)
23 self.results.append(utils.system_output(cmd, retain_output=True))
24
25
26 def postprocess(self):
27 for line in self.results:
28 if line.startswith('Time:'):
29 time_val = line.split()[1]
30 self.write_perf_keyval({'time': time_val})