summaryrefslogtreecommitdiffstats
path: root/rteval
diff options
context:
space:
mode:
authorClark Williams <williams@redhat.com>2010-07-08 14:49:40 -0500
committerClark Williams <williams@redhat.com>2010-07-08 14:49:40 -0500
commit08dab7d82036c69052322ca8ea40223169a4c908 (patch)
tree26052335a24eeca643c1a4717ff457d0b30ba4bf /rteval
parent9b7d1b7f41da3973424aa9e5decf7cc96a310386 (diff)
downloadrteval-08dab7d82036c69052322ca8ea40223169a4c908.tar.gz
rteval-08dab7d82036c69052322ca8ea40223169a4c908.tar.xz
rteval-08dab7d82036c69052322ca8ea40223169a4c908.zip
convert loads and cyclictest to use parameter section for all parameters
Put all relevant data for the run in the params section passed to the loads and to cyclictest. This simplifies argument lists and centralizes where information may be found. Signed-off-by: Clark Williams <williams@redhat.com>
Diffstat (limited to 'rteval')
-rw-r--r--rteval/cyclictest.py22
-rw-r--r--rteval/hackbench.py8
-rw-r--r--rteval/kcompile.py8
-rw-r--r--rteval/load.py20
-rw-r--r--rteval/rteval.py41
-rw-r--r--rteval/rtevalConfig.py14
6 files changed, 62 insertions, 51 deletions
diff --git a/rteval/cyclictest.py b/rteval/cyclictest.py
index 7970f35..f48062a 100644
--- a/rteval/cyclictest.py
+++ b/rteval/cyclictest.py
@@ -156,18 +156,16 @@ class RunData(object):
class Cyclictest(Thread):
- def __init__(self, duration=None, priority = 95,
- outfile = None, threads = None, debugging=False,
- keepdata = False, params={}, numnodes=0):
+ def __init__(self, params={}):
Thread.__init__(self)
- self.duration = duration
- self.keepdata = keepdata
+ self.duration = params.setdefault('duration', None)
+ self.keepdata = params.setdefault('keepdata', False)
self.stopevent = Event()
self.finished = Event()
- self.threads = threads
- self.priority = priority
+ self.threads = params.setdefault('threads', None)
+ self.priority = params.setdefault('priority', 95)
self.interval = "-i100"
- self.debugging = debugging
+ self.debugging = params.setdefault('debugging', False)
self.reportfile = 'cyclictest.rpt'
self.params = params
f = open('/proc/cpuinfo')
@@ -186,8 +184,8 @@ class Cyclictest(Thread):
self.data['system'].description = ("(%d cores) " % numcores) + self.data['0'].description
self.dataitems = len(self.data.keys())
self.debug("system has %d cpu cores" % (self.dataitems - 1))
- self.numcores = numcores
- self.numnodes = numnodes
+ self.numcores = params.setdefault('numcores', 1)
+ self.numanodes = params.setdefault('numanodes', 0)
def __del__(self):
pass
@@ -196,8 +194,8 @@ class Cyclictest(Thread):
if self.debugging: print "cyclictest: %s" % str
def getmode(self):
- if self.numnodes > 1:
- self.debug("running in NUMA mode (%d nodes)" % self.numnodes)
+ if self.numanodes > 1:
+ self.debug("running in NUMA mode (%d nodes)" % self.numanodes)
return '--numa'
self.debug("running in SMP mode")
return '--smp'
diff --git a/rteval/hackbench.py b/rteval/hackbench.py
index 627241f..dd60abb 100644
--- a/rteval/hackbench.py
+++ b/rteval/hackbench.py
@@ -35,8 +35,8 @@ sys.pathconf = "."
import load
class Hackbench(load.Load):
- def __init__(self, builddir=None, srcdir=None, debug=False, num_cpus=1, params={}):
- load.Load.__init__(self, "hackbench", builddir, srcdir, debug, num_cpus, params)
+ def __init__(self, params={}):
+ load.Load.__init__(self, "hackbench", params)
def __del__(self):
null = open("/dev/null", "w")
@@ -78,5 +78,5 @@ class Hackbench(load.Load):
def genxml(self, x):
x.taggedvalue('command_line', ' '.join(self.args), {'name':'hackbench'})
-def create(builddir, srcdir, debug, num_cpus, params = {}):
- return Hackbench(builddir, srcdir, debug, num_cpus, params)
+def create(params = {}):
+ return Hackbench(params)
diff --git a/rteval/kcompile.py b/rteval/kcompile.py
index f57a18b..b363c57 100644
--- a/rteval/kcompile.py
+++ b/rteval/kcompile.py
@@ -34,8 +34,8 @@ import xmlout
kernel_prefix="linux-2.6"
class Kcompile(load.Load):
- def __init__(self, builddir=None, srcdir=None, debug=False, num_cpus=1, params={}):
- load.Load.__init__(self, "kcompile", builddir, srcdir, debug, num_cpus, params)
+ def __init__(self, params={}):
+ load.Load.__init__(self, "kcompile", params)
def setup(self):
# find our source tarball
@@ -127,6 +127,6 @@ class Kcompile(load.Load):
def genxml(self, x):
x.taggedvalue('command_line', ' '.join(self.args), {'name':'kcompile'})
-def create(builddir, srcdir, debug, num_cpus, params = {}):
- return Kcompile(builddir, srcdir, debug, num_cpus, params)
+def create(params = {}):
+ return Kcompile(params)
diff --git a/rteval/load.py b/rteval/load.py
index 8711d2d..48b9335 100644
--- a/rteval/load.py
+++ b/rteval/load.py
@@ -30,23 +30,19 @@ import subprocess
import threading
class Load(threading.Thread):
- def __init__(self, name="<unnamed>", builddir=None, srcdir=None,
- debug=False, num_cpus=1, params={}):
+ def __init__(self, name="<unnamed>", params={}):
threading.Thread.__init__(self)
self.name = name
- self.builddir = builddir # abs path to top dir
- self.srcdir = srcdir # abs path to src dir
- self.num_cpus = num_cpus
- self.debugging = debug
+ self.builddir = params.setdefault('builddir', None) # abs path to top dir
+ self.srcdir = params.setdefault('srcdir', None) # abs path to src dir
+ self.num_cpus = params.setdefault('numcores', 1)
+ self.debugging = params.setdefault('debugging', False)
+ self.source = params.setdefault('source', None)
+ self.params = params
+ self.ready = False
self.mydir = None
self.startevent = threading.Event()
self.stopevent = threading.Event()
- self.ready = False
- self.params = params
- if params.has_key('source'):
- self.source = params.source
- else:
- self.source = None
if not os.path.exists(self.builddir):
os.makedirs(self.builddir)
diff --git a/rteval/rteval.py b/rteval/rteval.py
index 8fcaf1f..229ce44 100644
--- a/rteval/rteval.py
+++ b/rteval/rteval.py
@@ -75,6 +75,7 @@ class RtEval(object):
self.workdir = os.getcwd()
self.inifile = None
self.cmd_options = {}
+ self.start = datetime.now()
default_config = {
'rteval': {
@@ -124,6 +125,14 @@ class RtEval(object):
self.debug("workdir: %s" % self.workdir)
+ # create our report directory
+ try:
+ self.make_report_dir()
+ except:
+ print "Cannot create the report dir!"
+ print "(is this an NFS filesystem with rootsquash turned on?)"
+ sys.exit(-1)
+
# prepare a mailer, if that's configured
if self.config.HasSection('smtp'):
self.mailer = rtevalMailer.rtevalMailer(self.config.GetSection('smtp'))
@@ -131,7 +140,6 @@ class RtEval(object):
self.mailer = None
self.loads = []
- self.start = None
self.cputopology = None
self.numcores = None
self.memsize = None
@@ -610,7 +618,6 @@ class RtEval(object):
l.join(2.0)
def make_report_dir(self):
- self.start = datetime.now()
t = self.start
i = 1
self.reportdir = os.path.join(self.workdir,
@@ -669,16 +676,24 @@ class RtEval(object):
self.info("setting up loads")
self.loads = []
+ params = {'workdir':self.workdir,
+ 'reportdir':self.reportdir,
+ 'builddir':builddir,
+ 'srcdir':self.config.srcdir,
+ 'verbose': self.config.verbose,
+ 'debugging': self.config.debugging,
+ 'numcores':self.numcores,
+ }
+
for m in self.load_modules:
+ self.config.AppendConfig(m.__name__, params)
self.info("creating load instance for %s" % m.__name__)
- self.loads.append(m.create(builddir, self.config.srcdir, self.config.verbose,
- self.numcores, self.config.GetSection(m.__name__)))
+ self.loads.append(m.create(self.config.GetSection(m.__name__)))
self.info("setting up cyclictest")
- self.cyclictest = cyclictest.Cyclictest(duration=self.config.duration,
- debugging=self.config.debugging,
- params=self.config.GetSection('cyclictest'),
- numnodes = self.numanodes)
+ params['duration'] = self.config.duration
+ params['numanodes'] = self.numanodes
+ self.cyclictest = cyclictest.Cyclictest(params=self.config.GetSection('cyclictest'))
nthreads = 0
try:
@@ -869,24 +884,18 @@ class RtEval(object):
self.debug('''rteval options:
workdir: %s
loaddir: %s
+ reportdir: %s
verbose: %s
debugging: %s
duration: %f
sysreport: %s
- inifile: %s''' % (self.workdir, self.config.srcdir, self.config.verbose,
+ inifile: %s''' % (self.workdir, self.config.srcdir, self.reportdir, self.config.verbose,
self.config.debugging, self.config.duration, self.config.sysreport,
self.inifile))
if not os.path.isdir(self.workdir):
raise RuntimeError, "work directory %d does not exist" % self.workdir
- try:
- self.make_report_dir()
- except:
- print "Cannot create the report dir!"
- print "(is this an NFS filesystem with rootsquash turned on?)"
- sys.exit(-1)
-
self.measure()
# if --xmlrpc-submit | -X was given, send our report to this host
diff --git a/rteval/rtevalConfig.py b/rteval/rtevalConfig.py
index bb77da2..6c933f7 100644
--- a/rteval/rtevalConfig.py
+++ b/rteval/rtevalConfig.py
@@ -77,6 +77,10 @@ class rtevalCfgSection(object):
"keys() wrapper for configuration data"
return self.__cfgdata.keys()
+ def setdefault(self, key, defvalue):
+ if not self.__dict__.has_key(key):
+ self.__dict__[key] = defvalue
+ return self.__dict__[key]
class rtevalConfig(rtevalCfgSection):
"Config parser for rteval"
@@ -166,10 +170,14 @@ class rtevalConfig(rtevalCfgSection):
def AppendConfig(self, section, cfgvars):
- "Add more config parameters to a section. cfgvards must be a dictionary of parameters"
+ "Add more config parameters to a section. cfgvard must be a dictionary of parameters"
- for o in cfgvars.__dict__.keys():
- self.__config_data[section][o] = cfgvars.__dict__[o]
+ if type(cfgvars) is dict:
+ for o in cfgvars.keys():
+ self.__config_data[section][o] = cfgvars[o]
+ else:
+ for o in cfgvars.__dict__.keys():
+ self.__config_data[section][o] = cfgvars.__dict__[o]
if section == 'rteval':
self._rtevalCfgSection__update_config_vars(self.__config_data['rteval'])