aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClark Williams <williams@redhat.com>2016-05-09 15:09:19 -0500
committerClark Williams <williams@redhat.com>2016-05-09 15:13:48 -0500
commit54a25cd1cbdf2f13ab1ab51ae6cd3a48067c3a6d (patch)
treef6b538d74ada353efc5a9f9ceb22b5dda432ae1f
parentb36f4d28cea8825e90649179324f884f9538a2f6 (diff)
downloadrteval-54a25cd1cbdf2f13ab1ab51ae6cd3a48067c3a6d.tar.gz
default cpulist for modules if only one specified
Bugzilla: 1333831 if only one of the cpulist options (--measurement-cpulist and --loads-cpulist) is specified, default the unspecified cpulist to be the inverse of the specified list. Signed-off-by: Clark Williams <williams@redhat.com>
-rwxr-xr-xrteval-cmd11
-rw-r--r--rteval/misc.py6
2 files changed, 16 insertions, 1 deletions
diff --git a/rteval-cmd b/rteval-cmd
index 6aaff4a..ed61d98 100755
--- a/rteval-cmd
+++ b/rteval-cmd
@@ -42,7 +42,7 @@ from rteval import RtEval, rtevalConfig
from rteval.modules.loads import LoadModules
from rteval.modules.measurement import MeasurementModules
from rteval.version import RTEVAL_VERSION
-
+from rteval.misc import online_cpus, invert_cpulist, compress_cpulist
def summarize(repfile, xslt):
isarchive = False
@@ -252,6 +252,15 @@ if __name__ == '__main__':
measuremods.SetupModuleOptions(parser)
cmd_args = parse_options(config, parser, sys.argv[1:])
+ # if we only specified one set of cpus (loads or measurement)
+ # default the other to the inverse of the specified list
+ ldcfg = config.GetSection('loads')
+ msrcfg = config.GetSection('measurement')
+ if not ldcfg.cpulist and msrcfg.cpulist:
+ ldcfg.cpulist = compress_cpulist(invert_cpulist(msrcfg.cpulist))
+ if not msrcfg.cpulist and ldcfg.cpulist:
+ msrcfg.cpulist = compress_cpulist(invert_cpulist(ldcfg.cpulist))
+
logger.log(Log.DEBUG, "workdir: %s" % rtevcfg.workdir)
# if --summarize was specified then just parse the XML, print it and exit
diff --git a/rteval/misc.py b/rteval/misc.py
index 062355a..7b55b34 100644
--- a/rteval/misc.py
+++ b/rteval/misc.py
@@ -38,6 +38,12 @@ def expand_cpulist(cpulist):
def online_cpus():
return [ str(c.replace('/sys/devices/system/cpu/cpu', '')) for c in glob.glob('/sys/devices/system/cpu/cpu[0-9]*') ]
+def invert_cpulist(cpulist):
+ return [ c for c in online_cpus() if c not in cpulist]
+
+def compress_cpulist(cpulist):
+ return ",".join(cpulist)
+
def cpuinfo():
core = -1
info = {}