diff options
author | Clark Williams <williams@redhat.com> | 2015-06-08 14:27:24 -0500 |
---|---|---|
committer | Clark Williams <williams@redhat.com> | 2015-06-10 11:44:38 -0500 |
commit | d604cda55824db23cf7a9889077227fcb334e1da (patch) | |
tree | 1961ce061c3e5bd869b83df07e754cdee4a7346e | |
parent | f1c7a8d55cdc5a796887da1da59ba7719a17f618 (diff) | |
download | rteval-d604cda55824db23cf7a9889077227fcb334e1da.tar.gz |
loads: added ability to place load threads on specific cpu range
Use the input cpulist from --loads-cpulist to place the kcompile
and hackbench loads (or any other load modules) on specific cpu
ranges with the 'taskset' utility.
Signed-off-by: Clark Williams <williams@redhat.com>
-rw-r--r-- | rteval/modules/__init__.py | 2 | ||||
-rw-r--r-- | rteval/modules/loads/__init__.py | 2 | ||||
-rw-r--r-- | rteval/modules/loads/hackbench.py | 18 | ||||
-rw-r--r-- | rteval/modules/loads/kcompile.py | 16 |
4 files changed, 29 insertions, 9 deletions
diff --git a/rteval/modules/__init__.py b/rteval/modules/__init__.py index cad593c..12a544b 100644 --- a/rteval/modules/__init__.py +++ b/rteval/modules/__init__.py @@ -270,7 +270,7 @@ the information provided by the module""" grparser = optparse.OptionGroup(parser, "Group Options for %s modules" % self.__modtype) grparser.add_option('--%s-cpulist' % self.__modtype, - dest='%s___cpulist' % self.__modtype, action='store', + dest='%s___cpulist' % self.__modtype, action='store', default="", help='CPU list where %s modules will run' % self.__modtype, metavar='LIST') parser.add_option_group(grparser) diff --git a/rteval/modules/loads/__init__.py b/rteval/modules/loads/__init__.py index 29754c6..040acc0 100644 --- a/rteval/modules/loads/__init__.py +++ b/rteval/modules/loads/__init__.py @@ -50,7 +50,7 @@ class LoadThread(rtevalModulePrototype): self.source = config.setdefault('source', None) self.reportdir = config.setdefault('reportdir', os.getcwd()) self.memsize = config.setdefault('memsize', (0, 'GB')) - self.cpulist = config.setdefault('cpulist', None) + self.cpulist = config.setdefault('cpulist', "") self._logging = config.setdefault('logging', True) self._cfg = config self.mydir = None diff --git a/rteval/modules/loads/hackbench.py b/rteval/modules/loads/hackbench.py index 12acbe7..f937e94 100644 --- a/rteval/modules/loads/hackbench.py +++ b/rteval/modules/loads/hackbench.py @@ -1,4 +1,4 @@ -# +# # hackbench.py - class to manage an instance of hackbench load # # Copyright 2009 - 2013 Clark Williams <williams@redhat.com> @@ -29,7 +29,7 @@ import sys, os, time, glob, subprocess, errno from signal import SIGKILL from rteval.modules.loads import CommandLineLoad from rteval.Log import Log - +from rteval.misc import expand_cpulist class Hackbench(CommandLineLoad): def __init__(self, config, logger): @@ -53,13 +53,21 @@ class Hackbench(CommandLineLoad): mult = 0 self._donotrun = True - self.jobs = self.num_cpus * mult + if self._cfg.has_key('cpulist') and self._cfg.cpulist: + cpulist = self._cfg.cpulist + self.jobs = len(expand_cpulist(cpulist)) * mult + else: + cpulist = "" + self.jobs = self.num_cpus * mult self.args = ['hackbench', '-P', - '-g', str(self.jobs), + '-g', str(self.jobs), '-l', str(self._cfg.setdefault('loops', '100')), '-s', str(self._cfg.setdefault('datasize', '100')) ] + if cpulist: + self.args = ['taskset', '-c', cpulist ] + self.args + self.__err_sleep = 5.0 @@ -135,7 +143,7 @@ class Hackbench(CommandLineLoad): def ModuleParameters(): return {"jobspercore": {"descr": "Number of working threads per CPU core", "default": 5, - "metavar": "NUM"} + "metavar": "NUM"}, } diff --git a/rteval/modules/loads/kcompile.py b/rteval/modules/loads/kcompile.py index 34a61cd..1eb2cde 100644 --- a/rteval/modules/loads/kcompile.py +++ b/rteval/modules/loads/kcompile.py @@ -28,6 +28,7 @@ from signal import SIGTERM from rteval.modules import rtevalRuntimeError from rteval.modules.loads import CommandLineLoad from rteval.Log import Log +from rteval.misc import expand_cpulist kernel_prefix="linux-2.6" @@ -95,7 +96,7 @@ class Kcompile(CommandLineLoad): # clean up from potential previous run try: - ret = subprocess.call(["make", "-C", self.mydir, "mrproper", "allmodconfig"], + ret = subprocess.call(["make", "-C", self.mydir, "mrproper", "allmodconfig"], stdin=null, stdout=out, stderr=err) if ret: raise rtevalRuntimeError(self, "kcompile setup failed: %d" % ret) @@ -136,10 +137,21 @@ class Kcompile(CommandLineLoad): else: self.__outfd = self.__errfd = self.__nullfd + if self._cfg.has_key('cpulist') and self._cfg.cpulist: + cpulist = self._cfg.cpulist + self.num_cpus = len(expand_cpulist(cpulist)) + else: + cpulist = "" + self.jobs = self.__calc_numjobs() self._log(Log.DEBUG, "starting loop (jobs: %d)" % self.jobs) + self.args = ["make", "-C", self.mydir, "-j%d" % self.jobs ] + + if cpulist: + self.args = ["taskset", '-c', cpulist] + self.args + self.__kcompileproc = None @@ -184,7 +196,7 @@ def ModuleParameters(): "metavar": "TARBALL"}, "jobspercore": {"descr": "Number of working threads per core", "default": 2, - "metavar": "NUM"} + "metavar": "NUM"}, } |