116 lines
4.3 KiB
Diff
116 lines
4.3 KiB
Diff
From e94a774b8c14e01622b170517eedb9e90232c42c Mon Sep 17 00:00:00 2001
|
|
From: John Kacur <jkacur@redhat.com>
|
|
Date: Thu, 23 Sep 2021 11:29:24 -0400
|
|
Subject: [PATCH 1/7] rteval: Make donotrun work correctly in load modules
|
|
|
|
hackbench and kcompile don't correctly adhere to the donotrun variable
|
|
which is inherited from class rtevalModulePrototype. If the variable is set
|
|
after the modules are loaded, although the modules do not run, some
|
|
thread accounting still occurs which causes problems on shutdown of
|
|
rteval.
|
|
|
|
Fix in the methods in hackbench and kcompile where this is relevant, by
|
|
checking the variable before the method runs.
|
|
|
|
While we are at it fix a few other things
|
|
- change len(threading.enumerate()) to threading.active_count()
|
|
- Fix a spelling typo
|
|
|
|
This patch is in preparation for a patch to allow stress-ng to run as a
|
|
load module without running other modules.
|
|
|
|
Signed-off-by: John Kacur <jkacur@redhat.com>
|
|
---
|
|
rteval/__init__.py | 4 ++--
|
|
rteval/modules/loads/__init__.py | 2 +-
|
|
rteval/modules/loads/hackbench.py | 3 +++
|
|
rteval/modules/loads/kcompile.py | 9 +++++++++
|
|
4 files changed, 15 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/rteval/__init__.py b/rteval/__init__.py
|
|
index 5faed23bc927..22af8e85d5aa 100644
|
|
--- a/rteval/__init__.py
|
|
+++ b/rteval/__init__.py
|
|
@@ -208,7 +208,7 @@ class RtEval(rtevalReport):
|
|
report_interval = int(self.__rtevcfg.report_interval)
|
|
if with_loads:
|
|
self._loadmods.Unleash()
|
|
- nthreads = len(threading.enumerate())
|
|
+ nthreads = threading.active_count()
|
|
else:
|
|
nthreads = None
|
|
self.__logger.log(Log.INFO, "Waiting 30 seconds to let load modules settle down")
|
|
@@ -233,7 +233,7 @@ class RtEval(rtevalReport):
|
|
"Measurement threads did not use the full time slot. Doing a controlled stop.")
|
|
|
|
if with_loads:
|
|
- if len(threading.enumerate()) < nthreads:
|
|
+ if threading.active_count() < nthreads:
|
|
raise RuntimeError("load thread died!")
|
|
|
|
if not load_avg_checked:
|
|
diff --git a/rteval/modules/loads/__init__.py b/rteval/modules/loads/__init__.py
|
|
index 9a942f454536..2c2105efa964 100644
|
|
--- a/rteval/modules/loads/__init__.py
|
|
+++ b/rteval/modules/loads/__init__.py
|
|
@@ -106,7 +106,7 @@ class LoadModules(RtEvalModules):
|
|
"Loads and imports all the configured modules"
|
|
|
|
for m in modcfg:
|
|
- # hope to eventually have different kinds but module is only on
|
|
+ # hope to eventually have different kinds but module is only one
|
|
# for now (jcw)
|
|
if m[1].lower() == 'module':
|
|
self._LoadModule(m[0])
|
|
diff --git a/rteval/modules/loads/hackbench.py b/rteval/modules/loads/hackbench.py
|
|
index 2fb90c1946a5..21a803b8a3cd 100644
|
|
--- a/rteval/modules/loads/hackbench.py
|
|
+++ b/rteval/modules/loads/hackbench.py
|
|
@@ -42,6 +42,9 @@ class Hackbench(CommandLineLoad):
|
|
CommandLineLoad.__init__(self, "hackbench", config, logger)
|
|
|
|
def _WorkloadSetup(self):
|
|
+ if self._donotrun:
|
|
+ return
|
|
+
|
|
'calculate arguments based on input parameters'
|
|
(mem, units) = self.memsize
|
|
if units == 'KB':
|
|
diff --git a/rteval/modules/loads/kcompile.py b/rteval/modules/loads/kcompile.py
|
|
index 8d08a3d44302..ec85b75f38b5 100644
|
|
--- a/rteval/modules/loads/kcompile.py
|
|
+++ b/rteval/modules/loads/kcompile.py
|
|
@@ -158,6 +158,9 @@ class Kcompile(CommandLineLoad):
|
|
"error removing builddir (%s) (ret=%d)" % (self.builddir, ret))
|
|
|
|
def _WorkloadSetup(self):
|
|
+ if self._donotrun:
|
|
+ return
|
|
+
|
|
# find our source tarball
|
|
if 'tarball' in self._cfg:
|
|
tarfile = os.path.join(self.srcdir, self._cfg.tarfile)
|
|
@@ -219,6 +222,9 @@ class Kcompile(CommandLineLoad):
|
|
|
|
|
|
def _WorkloadBuild(self):
|
|
+ if self._donotrun:
|
|
+ return
|
|
+
|
|
null = os.open("/dev/null", os.O_RDWR)
|
|
if self._logging:
|
|
out = self.open_logfile("kcompile-build.stdout")
|
|
@@ -293,6 +299,9 @@ class Kcompile(CommandLineLoad):
|
|
|
|
|
|
def _WorkloadCleanup(self):
|
|
+ if self._donotrun:
|
|
+ return
|
|
+
|
|
self._log(Log.DEBUG, "out of stopevent loop")
|
|
for n in self.buildjobs:
|
|
if self.buildjobs[n].jobid.poll() is None:
|
|
--
|
|
2.31.1
|
|
|