[PATCH 2/2] rteval: Add idea of exclusive load module and make stress-ng one

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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




[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux