rteval/SOURCES/rteval-Add-idea-of-exclusive-load-module-and-make-st.patch

80 lines
2.9 KiB
Diff
Raw Normal View History

2021-11-08 12:23:50 +00:00
From 89622562925f432396a07cb8d7bb07da89151f2f Mon Sep 17 00:00:00 2001
From: John Kacur <jkacur@redhat.com>
Date: Thu, 23 Sep 2021 14:12:40 -0400
Subject: [PATCH 2/7] rteval: Add idea of exclusive load module and make
stress-ng one
When running stress-ng as a load module in rteval, we don't want to run
kcompile or hackbench, so create the notion of an exclusive load module
and make stress-ng one.
Signed-off-by: John Kacur <jkacur@redhat.com>
---
rteval/modules/__init__.py | 21 +++++++++++++++++++++
rteval/modules/loads/stressng.py | 2 ++
2 files changed, 23 insertions(+)
diff --git a/rteval/modules/__init__.py b/rteval/modules/__init__.py
index 6ff82d10bf8c..d52dd597186a 100644
--- a/rteval/modules/__init__.py
+++ b/rteval/modules/__init__.py
@@ -58,6 +58,7 @@ class rtevalModulePrototype(threading.Thread):
"stop": threading.Event(),
"finished": threading.Event()}
self._donotrun = False
+ self._exclusive = False
self.__timestamps = {}
self.__sleeptime = 2.0
@@ -75,6 +76,16 @@ class rtevalModulePrototype(threading.Thread):
return self.__ready
+ def is_exclusive(self):
+ """ Returns true if this workload should run alone """
+ return self._exclusive
+
+
+ def set_donotrun(self):
+ """ set a module's donotrun field to True """
+ self._donotrun = True
+
+
def _setReady(self, state=True):
""" Sets the ready flag for the module """
self.__ready = state
@@ -459,7 +470,17 @@ class RtEvalModules:
raise rtevalRuntimeError("No %s modules configured" % self._module_type)
self._logger.log(Log.INFO, "Preparing %s modules" % self._module_type)
+ exclusive = 0
+ for (modname, mod) in self.__modules:
+ if mod.is_exclusive() and mod.WorkloadWillRun():
+ exclusive += 1
for (modname, mod) in self.__modules:
+ if exclusive >= 1:
+ if exclusive != 1:
+ msg = f"More than one exclusive load: {exclusive}"
+ raise RuntimeError(msg)
+ if not mod.is_exclusive() and mod.WorkloadWillRun():
+ mod.set_donotrun()
mod.start()
if mod.WorkloadWillRun():
self._logger.log(Log.DEBUG, "\t - Started %s preparations" % modname)
diff --git a/rteval/modules/loads/stressng.py b/rteval/modules/loads/stressng.py
index 926de38e3116..d084814142fb 100644
--- a/rteval/modules/loads/stressng.py
+++ b/rteval/modules/loads/stressng.py
@@ -27,6 +27,8 @@ class Stressng(CommandLineLoad):
self._donotrun = False
else:
self._donotrun = True
+ """ When this module runs, other load modules should not """
+ self._exclusive = True
def _WorkloadSetup(self):
" Since there is nothing to build, we don't need to do anything here "
--
2.31.1