Hackbench is a benchmark for measuring the performance, overhead,
and scalability of the Linux scheduler. Thanks to David Rientjes
(rientjes@google.com) for suggesting we add this benchmark to
autotest. Thanks to Randy Dunlap for pointing me to an updated
version of hackbench.
Hackbench source taken from:
http://people.redhat.com/~mingo/cfs-scheduler/tools/hackbench.c
For more information about hackbench, visit:
http://devresources.linux-foundation.org/craiger/hackbench/
Signed-off-by: Nikhil Rao <ncrao@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@2275 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/tests/hackbench/hackbench.py b/client/tests/hackbench/hackbench.py
new file mode 100644
index 0000000..73b20d2
--- /dev/null
+++ b/client/tests/hackbench/hackbench.py
@@ -0,0 +1,31 @@
+import os
+from autotest_lib.client.bin import test, autotest_utils
+from autotest_lib.client.common_lib import utils
+
+
+class hackbench(test.test):
+ version = 1
+ preserve_srcdir = True
+
+
+ def setup(self):
+ os.chdir(self.srcdir)
+ utils.system('cc -lpthread hackbench.c -o hackbench')
+
+
+ def initialize(self):
+ self.job.require_gcc()
+ self.results = []
+
+
+ def run_once(self, num_groups=90):
+ hackbench_bin = os.path.join(self.srcdir, 'hackbench')
+ cmd = '%s %s' % (hackbench_bin, num_groups)
+ self.results.append(utils.system_output(cmd, retain_output=True))
+
+
+ def postprocess(self):
+ for line in self.results:
+ if line.startswith('Time:'):
+ time_val = line.split()[1]
+ self.write_perf_keyval({'time': time_val})