In kernbench and tbench, replace count_cpus() by job.cpu_count(),
to scale the test's default # of threads to the number of cpu cores in that job's
container, instead of to all cores in the whole machine.
From: Duane Sand <duanes@google.com>
Signed-off-by: John Admanski <jadmanski@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@1350 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/tests/kernbench/kernbench.py b/client/tests/kernbench/kernbench.py
index a955206..b68e829 100755
--- a/client/tests/kernbench/kernbench.py
+++ b/client/tests/kernbench/kernbench.py
@@ -3,7 +3,7 @@
import re
class kernbench(test.test):
- version = 1
+ version = 2
def setup(self, build_dir = None):
if not build_dir:
@@ -57,7 +57,9 @@
kernel.config(defconfig=True, logged=False)
- def execute(self, iterations = 1, threads = 2*count_cpus(), dir = None, version = None):
+ def execute(self, iterations = 1, threads = None, dir = None, version = None):
+ if not threads:
+ threads = self.job.cpu_count()*2
if dir:
build_dir = dir
else:
diff --git a/client/tests/tbench/tbench.py b/client/tests/tbench/tbench.py
index 65a2aa6..f85024c 100755
--- a/client/tests/tbench/tbench.py
+++ b/client/tests/tbench/tbench.py
@@ -2,7 +2,7 @@
from autotest_utils import *
class tbench(test.test):
- version = 1
+ version = 2
# http://samba.org/ftp/tridge/dbench/dbench-3.04.tar.gz
def setup(self, tarball = 'dbench-3.04.tar.gz'):
@@ -13,9 +13,12 @@
system('./configure')
system('make')
- def execute(self, iterations = 1, args = count_cpus()):
+ def execute(self, iterations = 1, nprocs = None, args = ''):
# only supports combined server+client model at the moment
# should support separate I suppose, but nobody uses it
+ if not nprocs:
+ nprocs = self.job.cpu_count()
+ args += ' %s' % nprocs
profilers = self.job.profilers
if not profilers.only():
for i in range(iterations):