diff mbox series

rteval: If the user doesn't specify a cpumask, use the inherited one

Message ID 20220215041328.416853-1-jkacur@redhat.com
State New
Headers show
Series rteval: If the user doesn't specify a cpumask, use the inherited one | expand

Commit Message

John Kacur Feb. 15, 2022, 4:13 a.m. UTC
If the user doesn't specify a cpumask, then we need to use the inherited
one to match what cyclictest currently does

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 rteval/modules/measurement/cyclictest.py | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/rteval/modules/measurement/cyclictest.py b/rteval/modules/measurement/cyclictest.py
index 4ca310bf7490..8fdd5341794a 100644
--- a/rteval/modules/measurement/cyclictest.py
+++ b/rteval/modules/measurement/cyclictest.py
@@ -216,6 +216,12 @@  class Cyclictest(rtevalModulePrototype):
             self.__sparse = True
         else:
             self.__cpus = online_cpus()
+            # Get the cpuset from the environment
+            cpuset = os.sched_getaffinity(0)
+            # Convert the elements to strings
+            cpuset = [str(c) for c in cpuset]
+            # Only include cpus that are in the cpuset
+            self.__cpus = [c for c in self.__cpus if c in cpuset]
 
         # Sort the list of cpus to align with the order reported by cyclictest
         self.__cpus.sort(key=int)