rteval: Refactor CPU list logic
v2 cover rteval: Refactor CPU list logic
From: Tomas Glozar <[email protected]>
The main change of this patchset is the removal of the CpuList class, moving the related logic to a new module rteval.cpulist_utils. Motivation for this is further explained in the corresponding commit description.
In addition to that, there are a few smaller fixes in the first two commits. These can be merged separately from the removal of the CpuList class in the third commit.
v2: First patch ("rteval: Refactor collapse_cpulist in systopology") broke --measurement-run-on-isolcpus because the new implementation of collapse_cpulist does not allow for string cpus in input. Changed to always convert cpus to string when passing to collapse_cpulist.
Third patch ("rteval: Convert CpuList class to a module") was missing replacing the old calls to CpuList functions with the new cpulist_util ones at a few places, causing rteval to fail to run with --*-cpulist option. Fixed.
Tomas Glozar (3):
rteval: Refactor collapse_cpulist in systopology
rteval: Minor improvements to CpuList class
rteval: Convert CpuList class to a module
rteval-cmd | 17 +- rteval/cpulist_utils.py | 125 +++++++++++++++ rteval/modules/loads/__init__.py | 8 +- rteval/modules/loads/hackbench.py | 9 +- rteval/modules/loads/kcompile.py | 14 +- rteval/modules/loads/stressng.py | 9 +- rteval/modules/measurement/__init__.py | 8 +- rteval/modules/measurement/cyclictest.py | 12 +- rteval/systopology.py | 190 ++--------------------- 9 files changed, 175 insertions(+), 217 deletions(-) create mode 100644 rteval/cpulist_utils.py
Signature · 1 line
2.41.0
PATCH v2 1/3 rteval: Refactor collapse_cpulist in systopology
From: Tomas Glozar <[email protected]>
Instead of having duplicate code in two functions, one top-level and one member function of CpuList, have only one static function in CpuList.
Additionally re-write the implementation to use a more straight forward one-pass algorithm.
--- rteval-cmd | 4 +- rteval/modules/loads/__init__.py | 4 +- rteval/modules/measurement/__init__.py | 4 +- rteval/modules/measurement/cyclictest.py | 6 +-- rteval/systopology.py | 68 ++++++++---------------- 5 files changed, 30 insertions(+), 56 deletions(-)
rteval-cmd +2 -2
@@ -30,7 +30,7 @@ from rteval import RtEval, rtevalConfig from rteval.modules.loads import LoadModules from rteval.modules.measurement import MeasurementModules from rteval.version import RTEVAL_VERSION -from rteval.systopology import CpuList, SysTopology, collapse_cpulist +from rteval.systopology import CpuList, SysTopology from rteval.modules.loads.kcompile import ModuleParameters compress_cpulist = CpuList.compress_cpulist
@@ -211,7 +211,7 @@ def remove_offline(cpulist): """ return cpulist in collapsed compressed form with only online cpus """ tmplist = expand_cpulist(cpulist) tmplist = SysTopology().online_cpulist(tmplist) - return collapse_cpulist(tmplist) + return CpuList.collapse_cpulist(tmplist) if __name__ == '__main__':
rteval/modules/loads/__init__.py +2 -2
@@ -11,7 +11,7 @@ import libxml2 from rteval.Log import Log from rteval.rtevalConfig import rtevalCfgSection from rteval.modules import RtEvalModules, rtevalModulePrototype -from rteval.systopology import collapse_cpulist, CpuList, SysTopology as SysTop +from rteval.systopology import CpuList, SysTopology as SysTop class LoadThread(rtevalModulePrototype): def __init__(self, name, config, logger=None):
@@ -120,7 +120,7 @@ class LoadModules(RtEvalModules): cpulist = CpuList(cpulist).cpulist else: cpulist = SysTop().default_cpus() - rep_n.newProp("loadcpus", collapse_cpulist(cpulist)) + rep_n.newProp("loadcpus", CpuList.collapse_cpulist(cpulist)) return rep_n
rteval/modules/measurement/__init__.py +2 -2
@@ -5,7 +5,7 @@ import libxml2 from rteval.modules import RtEvalModules, ModuleContainer -from rteval.systopology import collapse_cpulist, CpuList, SysTopology as SysTop +from rteval.systopology import CpuList, SysTopology as SysTop class MeasurementProfile(RtEvalModules): """Keeps and controls all the measurement modules with the same measurement profile"""
@@ -187,7 +187,7 @@ measurement profiles, based on their characteristics""" cpulist = CpuList(cpulist).cpulist else: cpulist = SysTop().online_cpus() if run_on_isolcpus else SysTop().default_cpus() - rep_n.newProp("measurecpus", collapse_cpulist(cpulist)) + rep_n.newProp("measurecpus", CpuList.collapse_cpulist(cpulist)) for mp in self.__measureprofiles: mprep_n = mp.MakeReport()
rteval/modules/measurement/cyclictest.py +3 -3
@@ -17,7 +17,7 @@ import libxml2 from rteval.Log import Log from rteval.modules import rtevalModulePrototype from rteval.systopology import cpuinfo -from rteval.systopology import CpuList, SysTopology, collapse_cpulist +from rteval.systopology import CpuList, SysTopology expand_cpulist = CpuList.expand_cpulist
@@ -203,7 +203,7 @@ class Cyclictest(rtevalModulePrototype): # Only include online cpus self.__cpus = CpuList(self.__cpus).cpulist # Reset cpulist from the newly calculated self.__cpus - self.__cpulist = collapse_cpulist(self.__cpus) + self.__cpulist = CpuList.collapse_cpulist(self.__cpus) self.__cpus = [str(c) for c in self.__cpus] self.__sparse = True if self.__run_on_isolcpus:
@@ -220,7 +220,7 @@ class Cyclictest(rtevalModulePrototype): self.__cpus = [c for c in self.__cpus if c in cpuset or self.__run_on_isolcpus and c in isolcpus] if self.__run_on_isolcpus: self.__sparse = True - self.__cpulist = collapse_cpulist(self.__cpus) + self.__cpulist = CpuList.collapse_cpulist([int(c) for c in self.__cpus]) # Sort the list of cpus to align with the order reported by cyclictest self.__cpus.sort(key=int)
rteval/systopology.py +21 -47
95 lines not on this page · raw message
Signature · 1 line
2.41.0
PATCH v2 2/3 rteval: Minor improvements to CpuList class
In reply to [email protected]From: Tomas Glozar <[email protected]>
- Remove unnecessary if-else from online_file_exists
- Use cpupath in online_file_exists
- Check for cpu0 instead of cpu1 in online_file_exists
- In is_online, remove check for n in cpuset and make it static
- Mark also the remaining methods static since they do not rely on any fields of the class
--- rteval/systopology.py | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-)
rteval/systopology.py +12 -14
@@ -82,12 +82,14 @@ class CpuList: def __len__(self): return len(self.cpulist) + def getcpulist(self): + """ return the list of cpus tracked """ + return self.cpulist + @staticmethod def online_file_exists(): """ Check whether machine / kernel is configured with online file """ - if os.path.exists('/sys/devices/system/cpu/cpu1/online'): - return True - return False + return os.path.exists(os.path.join(CpuList.cpupath, "cpu0/online")) @staticmethod def isolated_file_exists():
@@ -147,14 +149,9 @@ class CpuList: result.append(a) return [int(i) for i in list(set(result))] - def getcpulist(self): - """ return the list of cpus tracked """ - return self.cpulist - - def is_online(self, n): + @staticmethod + def is_online(n): """ check whether cpu n is online """ - if n not in self.cpulist: - raise RuntimeError(f"invalid cpu number {n}") path = os.path.join(CpuList.cpupath, f'cpu{n}') # Some hardware doesn't allow cpu0 to be turned off
@@ -163,16 +160,17 @@ class CpuList: return sysread(path, "online") == "1" - def online_cpulist(self, cpulist): + @staticmethod + def online_cpulist(cpulist): """ Given a cpulist, return a cpulist of online cpus """ # This only works if the sys online files exist - if not self.online_file_exists(): + if not CpuList.online_file_exists(): return cpulist newlist = [] for cpu in cpulist: - if not self.online_file_exists() and cpu == '0': + if not CpuList.online_file_exists() and cpu == '0': newlist.append(cpu) - elif self.is_online(int(cpu)): + elif CpuList.is_online(int(cpu)): newlist.append(cpu) return newlist
Signature · 1 line
2.41.0
Re: [PATCH v2 2/3] rteval: Minor improvements to CpuList class
Quoted 5 lines · On Thu, 23 Nov 2023, [email protected] wrote:
From: Tomas Glozar <[email protected]>
- Remove unnecessary if-else from
online_file_exists
- Use cpupath inonline_file_exists
- Check for cpu0 instead of cpu1 inonline_file_exists
The reason we check cpu1 is that on some hardware where you can't turn off cpu0, the online file also doesn't exist even though it is available for other cpus. We only want to learn whether we can use it in general or not.
For example on my laptop
[jkacur@fionn rteval]$ ls /sys/devices/system/cpu/cpu0/online
ls: cannot access '/sys/devices/system/cpu/cpu0/online': No such file or directory
[jkacur@fionn rteval]$ ls /sys/devices/system/cpu/cpu1/online /sys/devices/system/cpu/cpu1/online
John
Quoted 75 lines
- In
is_online, remove check for n in cpuset and make it static
- Mark also the remaining methods static since they do not rely on any fields of the classSigned-off-by Tomas Glozar <[email protected]>--- rteval/systopology.py | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-)rteval/systopology.py +12
-14@@ -82,12 +82,14 @@ class CpuList: def __len__(self): return len(self.cpulist) + def getcpulist(self): + """ return the list of cpus tracked """ + return self.cpulist + @staticmethod def online_file_exists(): """ Check whether machine / kernel is configured with online file """ - if os.path.exists('/sys/devices/system/cpu/cpu1/online'): - return True - return False + return os.path.exists(os.path.join(CpuList.cpupath, "cpu0/online")) @staticmethod def isolated_file_exists():@@ -147,14 +149,9 @@ class CpuList: result.append(a) return [int(i) for i in list(set(result))] - def getcpulist(self): - """ return the list of cpus tracked """ - return self.cpulist - - def is_online(self, n): + @staticmethod + def is_online(n): """ check whether cpu n is online """ - if n not in self.cpulist: - raise RuntimeError(f"invalid cpu number {n}") path = os.path.join(CpuList.cpupath, f'cpu{n}') # Some hardware doesn't allow cpu0 to be turned off@@ -163,16 +160,17 @@ class CpuList: return sysread(path, "online") == "1" - def online_cpulist(self, cpulist): + @staticmethod + def online_cpulist(cpulist): """ Given a cpulist, return a cpulist of online cpus """ # This only works if the sys online files exist - if not self.online_file_exists(): + if not CpuList.online_file_exists(): return cpulist newlist = [] for cpu in cpulist: - if not self.online_file_exists() and cpu == '0': + if not CpuList.online_file_exists() and cpu == '0': newlist.append(cpu) - elif self.is_online(int(cpu)): + elif CpuList.is_online(int(cpu)): newlist.append(cpu) return newlistSignature · 1 line
2.41.0
Re: [PATCH v2 2/3] rteval: Minor improvements to CpuList class
čt 23. 11. 2023 v 17:21 odesílatel John Kacur <[email protected]> napsal:
Quoted 6 lines
The reason we check cpu1 is that on some hardware where you can't turn off cpu0, the online file also doesn't exist even though it is available for other cpus. We only want to learn whether we can use it in general or not.
For example on my laptop
Quoted 8 lines
[jkacur@fionn rteval]$ ls
/sys/devices/system/cpu/cpu0/online
ls: cannot access '/sys/devices/system/cpu/cpu0/online': No such file or directory
[jkacur@fionn rteval]$ ls/sys/devices/system/cpu/cpu1/online/sys/devices/system/cpu/cpu1/onlineJohn
Oh I've never encountered that, thanks for pointing that out, that's interesting. I'd say we should check for cpu0 || cpu1 then.
Tomas
Re: [PATCH v2 2/3] rteval: Minor improvements to CpuList class
Quoted 13 lines · Tomas Glozar
čt 23. 11. 2023 v 17:21 odesílatel John Kacur <[email protected]> napsal:
Quoted 12 lines
The reason we check cpu1 is that on some hardware where you can't turn off cpu0, the online file also doesn't exist even though it is available for other cpus. We only want to learn whether we can use it in general or not.
For example on my laptop
[jkacur@fionn rteval]$ ls
/sys/devices/system/cpu/cpu0/online
ls: cannot access '/sys/devices/system/cpu/cpu0/online': No such file or directory
[jkacur@fionn rteval]$ ls/sys/devices/system/cpu/cpu1/online/sys/devices/system/cpu/cpu1/online
Quoted 6 lines
Quoted 2 lines
John
Oh I've never encountered that, thanks for pointing that out, that's interesting. I'd say we should check for cpu0 || cpu1 then.
Or just check cpu1 like we already do!
John
Re: [PATCH v2 2/3] rteval: Minor improvements to CpuList class
pá 24. 11. 2023 v 16:27 odesílatel John Kacur <[email protected]> napsal:
Quoted 3 lines
Or just check cpu1 like we already do!
John
That won't work on machines that have only one CPU though.
Re: [PATCH v2 2/3] rteval: Minor improvements to CpuList class
Quoted 7 lines · Tomas Glozar
pá 24. 11. 2023 v 16:27 odesílatel John Kacur <[email protected]> napsal:
Quoted 3 lines
Or just check cpu1 like we already do!
John
That won't work on machines that have only one CPU though.
Sure it will, because if a machine only has one CPU we assume that it is online. :)
if cpu0 has an online file because it can be turned off, we will use it. if cpu0 doesn't have the online file, it can't be turned off.
Are online files configured? check cpu1, done.
John
Re: [PATCH v2 2/3] rteval: Minor improvements to CpuList class
pá 24. 11. 2023 v 21:06 odesílatel John Kacur <[email protected]> napsal:
Quoted 4 lines
Sure it will, because if a machine only has one CPU we assume that it is online. :)
You are right, I thought I had an error when I run rteval in QEMU with only one CPU (which I set for testing some unrelated issue originally) but looking at it now I cannot reproduce it, maybe I remember it wrong.
Thanks for review.
Tomas
Re: [PATCH v2 2/3] rteval: Minor improvements to CpuList class
In reply to Tomas GlozarQuoted 6 lines · Tomas Glozar
pá 24. 11. 2023 v 16:27 odesílatel John Kacur <[email protected]> napsal:
Quoted 3 lines
Or just check cpu1 like we already do!
John
That won't work on machines that have only one CPU though.
Does that flavor actually exist? 4 seems to be pretty std now.
Quoted 3 lines
.
Cheers, Gene Heskett.
Signature · 5 lines
"There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author, 1940) If we desire respect for the law, we must first make the law respectable. - Louis D. Brandeis
PATCH v2 3/3 rteval: Convert CpuList class to a module
In reply to [email protected]From: Tomas Glozar <[email protected]>
Move out code from CpuList class in rteval.systopology into a separate module named rteval.cpulist_utils and avoid wrapping CPU lists in a CpuList object.
Almost all uses of CpuList in the code either use the static methods of the class or its constructor to filter online CPUs by running CpuList(...).cpulist. The only exception to this are NumaNode and SimNumaNode classes in systopology; these store a CpuList object, however their .getcpulist() method extracts the list out. Thus, the class is completely unnecessary.
Note: A better name for the module would be cpulist, consistent with the original name of the class, but this name is already used for variables throughout the code, hence cpulist_utils is used instead.
--- rteval-cmd | 17 ++- rteval/cpulist_utils.py | 125 +++++++++++++++++ rteval/modules/loads/__init__.py | 8 +- rteval/modules/loads/hackbench.py | 9 +- rteval/modules/loads/kcompile.py | 14 +- rteval/modules/loads/stressng.py | 9 +- rteval/modules/measurement/__init__.py | 8 +- rteval/modules/measurement/cyclictest.py | 12 +- rteval/systopology.py | 162 ++--------------------- 9 files changed, 175 insertions(+), 189 deletions(-) create mode 100644 rteval/cpulist_utils.py
rteval-cmd +8 -9
@@ -30,11 +30,10 @@ from rteval import RtEval, rtevalConfig from rteval.modules.loads import LoadModules from rteval.modules.measurement import MeasurementModules from rteval.version import RTEVAL_VERSION -from rteval.systopology import CpuList, SysTopology +from rteval.systopology import SysTopology from rteval.modules.loads.kcompile import ModuleParameters +import rteval.cpulist_utils as cpulist_utils -compress_cpulist = CpuList.compress_cpulist -expand_cpulist = CpuList.expand_cpulist def summarize(repfile, xslt): """ Summarize an already existing XML report """
@@ -209,9 +208,9 @@ def parse_options(cfg, parser, cmdargs): def remove_offline(cpulist): """ return cpulist in collapsed compressed form with only online cpus """ - tmplist = expand_cpulist(cpulist) + tmplist = cpulist_utils.expand_cpulist(cpulist) tmplist = SysTopology().online_cpulist(tmplist) - return CpuList.collapse_cpulist(tmplist) + return cpulist_utils.collapse_cpulist(tmplist) if __name__ == '__main__':
@@ -343,14 +342,14 @@ if __name__ == '__main__': # if we only specified one set of cpus (loads or measurement) # default the other to the inverse of the specified list if not ldcfg.cpulist and msrcfg.cpulist: - tmplist = expand_cpulist(msrcfg.cpulist) + tmplist = cpulist_utils.expand_cpulist(msrcfg.cpulist) tmplist = SysTopology().invert_cpulist(tmplist) - ldcfg.cpulist = compress_cpulist(tmplist) + ldcfg.cpulist = cpulist_utils.compress_cpulist(tmplist) msrcfg.cpulist = remove_offline(msrcfg.cpulist) if not msrcfg.cpulist and ldcfg.cpulist: - tmplist = expand_cpulist(ldcfg.cpulist) + tmplist = cpulist_utils.expand_cpulist(ldcfg.cpulist) tmplist = SysTopology().invert_cpulist(tmplist) - msrcfg.cpulist = compress_cpulist(tmplist) + msrcfg.cpulist = cpulist_utils.compress_cpulist(tmplist) ldcfg.cpulist = remove_offline(ldcfg.cpulist) if ldcfg.cpulist:
rteval/cpulist_utils.py new file +125 -0
125 lines not on this page · raw message
rteval/modules/loads/__init__.py +5 -3
@@ -11,7 +11,8 @@ import libxml2 from rteval.Log import Log from rteval.rtevalConfig import rtevalCfgSection from rteval.modules import RtEvalModules, rtevalModulePrototype -from rteval.systopology import CpuList, SysTopology as SysTop +from rteval.systopology import SysTopology as SysTop +import rteval.cpulist_utils as cpulist_utils class LoadThread(rtevalModulePrototype): def __init__(self, name, config, logger=None):
@@ -117,10 +118,11 @@ class LoadModules(RtEvalModules): cpulist = self._cfg.GetSection(self._module_config).cpulist if cpulist: # Convert str to list and remove offline cpus - cpulist = CpuList(cpulist).cpulist + cpulist = cpulist_utils.expand_cpulist(cpulist) + cpulist = cpulist_utils.online_cpulist(cpulist) else: cpulist = SysTop().default_cpus() - rep_n.newProp("loadcpus", CpuList.collapse_cpulist(cpulist)) + rep_n.newProp("loadcpus", cpulist_utils.collapse_cpulist(cpulist)) return rep_n
rteval/modules/loads/hackbench.py +4 -5
@@ -16,10 +16,9 @@ import errno from signal import SIGKILL from rteval.modules.loads import CommandLineLoad from rteval.Log import Log -from rteval.systopology import CpuList, SysTopology +from rteval.systopology import SysTopology +import rteval.cpulist_utils as cpulist_utils -expand_cpulist = CpuList.expand_cpulist -isolated_cpulist = CpuList.isolated_cpulist class Hackbench(CommandLineLoad): def __init__(self, config, logger):
@@ -58,10 +57,10 @@ class Hackbench(CommandLineLoad): self.cpus[n] = sysTop.getcpus(int(n)) # if a cpulist was specified, only allow cpus in that list on the node if self.cpulist: - self.cpus[n] = [c for c in self.cpus[n] if c in expand_cpulist(self.cpulist)] + self.cpus[n] = [c for c in self.cpus[n] if c in cpulist_utils.expand_cpulist(self.cpulist)] # if a cpulist was not specified, exclude isolated cpus else: - self.cpus[n] = CpuList.nonisolated_cpulist(self.cpus[n]) + self.cpus[n] = cpulist_utils.nonisolated_cpulist(self.cpus[n]) # track largest number of cpus used on a node node_biggest = len(self.cpus[n])
rteval/modules/loads/kcompile.py +6 -8
@@ -14,11 +14,9 @@ import subprocess from rteval.modules import rtevalRuntimeError from rteval.modules.loads import CommandLineLoad from rteval.Log import Log -from rteval.systopology import CpuList, SysTopology +from rteval.systopology import SysTopology +import rteval.cpulist_utils as cpulist_utils -expand_cpulist = CpuList.expand_cpulist -compress_cpulist = CpuList.compress_cpulist -nonisolated_cpulist = CpuList.nonisolated_cpulist DEFAULT_KERNEL_PREFIX = "linux-6.1"
@@ -38,7 +36,7 @@ class KBuildJob: os.mkdir(self.objdir) # Exclude isolated CPUs if cpulist not set - cpus_available = len(nonisolated_cpulist(self.node.cpus.cpulist)) + cpus_available = len(cpulist_utils.nonisolated_cpulist(self.node.cpus)) if os.path.exists('/usr/bin/numactl') and not cpulist: # Use numactl
@@ -47,7 +45,7 @@ class KBuildJob: elif cpulist: # Use taskset self.jobs = self.calc_jobs_per_cpu() * len(cpulist) - self.binder = f'taskset -c {compress_cpulist(cpulist)}' + self.binder = f'taskset -c {cpulist_utils.compress_cpulist(cpulist)}' else: # Without numactl calculate number of jobs from the node self.jobs = self.calc_jobs_per_cpu() * cpus_available
@@ -220,7 +218,7 @@ class Kcompile(CommandLineLoad): # if a cpulist was specified, only allow cpus in that list on the node if self.cpulist: - self.cpus[n] = [c for c in self.cpus[n] if c in expand_cpulist(self.cpulist)] + self.cpus[n] = [c for c in self.cpus[n] if c in cpulist_utils.expand_cpulist(self.cpulist)] # remove nodes with no cpus available for running for node, cpus in self.cpus.items():
@@ -282,7 +280,7 @@ class Kcompile(CommandLineLoad): if 'cpulist' in self._cfg and self._cfg.cpulist: cpulist = self._cfg.cpulist - self.num_cpus = len(expand_cpulist(cpulist)) + self.num_cpus = len(cpulist_utils.expand_cpulist(cpulist)) else: cpulist = ""
rteval/modules/loads/stressng.py +4 -5
@@ -7,10 +7,9 @@ import subprocess import signal from rteval.modules.loads import CommandLineLoad from rteval.Log import Log -from rteval.systopology import CpuList, SysTopology +from rteval.systopology import SysTopology +import rteval.cpulist_utils as cpulist_utils -expand_cpulist = CpuList.expand_cpulist -nonisolated_cpulist = CpuList.nonisolated_cpulist class Stressng(CommandLineLoad): " This class creates a load module that runs stress-ng "
@@ -70,10 +69,10 @@ class Stressng(CommandLineLoad): cpus[n] = systop.getcpus(int(n)) # if a cpulist was specified, only allow cpus in that list on the node if self.cpulist: - cpus[n] = [c for c in cpus[n] if c in expand_cpulist(self.cpulist)] + cpus[n] = [c for c in cpus[n] if c in cpulist_utils.expand_cpulist(self.cpulist)] # if a cpulist was not specified, exclude isolated cpus else: - cpus[n] = CpuList.nonisolated_cpulist(cpus[n]) + cpus[n] = cpulist_utils.nonisolated_cpulist(cpus[n]) # remove nodes with no cpus available for running
rteval/modules/measurement/__init__.py +5 -3
@@ -5,7 +5,8 @@ import libxml2 from rteval.modules import RtEvalModules, ModuleContainer -from rteval.systopology import CpuList, SysTopology as SysTop +from rteval.systopology import SysTopology as SysTop +import rteval.cpulist_utils as cpulist_utils class MeasurementProfile(RtEvalModules): """Keeps and controls all the measurement modules with the same measurement profile"""
@@ -184,10 +185,11 @@ measurement profiles, based on their characteristics""" run_on_isolcpus = self.__cfg.GetSection("measurement").run_on_isolcpus if cpulist: # Convert str to list and remove offline cpus - cpulist = CpuList(cpulist).cpulist + cpulist = cpulist_utils.expand_cpulist(cpulist) + cpulist = cpulist_utils.online_cpulist(cpulist) else: cpulist = SysTop().online_cpus() if run_on_isolcpus else SysTop().default_cpus() - rep_n.newProp("measurecpus", CpuList.collapse_cpulist(cpulist)) + rep_n.newProp("measurecpus", cpulist_utils.collapse_cpulist(cpulist)) for mp in self.__measureprofiles: mprep_n = mp.MakeReport()
rteval/modules/measurement/cyclictest.py +6 -6
@@ -17,9 +17,9 @@ import libxml2 from rteval.Log import Log from rteval.modules import rtevalModulePrototype from rteval.systopology import cpuinfo -from rteval.systopology import CpuList, SysTopology +from rteval.systopology import SysTopology +import rteval.cpulist_utils as cpulist_utils -expand_cpulist = CpuList.expand_cpulist class RunData: '''class to keep instance data from a cyclictest run'''
@@ -199,11 +199,11 @@ class Cyclictest(rtevalModulePrototype): if self.__cfg.cpulist: self.__cpulist = self.__cfg.cpulist - self.__cpus = expand_cpulist(self.__cpulist) + self.__cpus = cpulist_utils.expand_cpulist(self.__cpulist) # Only include online cpus - self.__cpus = CpuList(self.__cpus).cpulist + self.__cpus = cpulist_utils.online_cpulist(self.__cpus) # Reset cpulist from the newly calculated self.__cpus - self.__cpulist = CpuList.collapse_cpulist(self.__cpus) + self.__cpulist = cpulist_utils.collapse_cpulist(self.__cpus) self.__cpus = [str(c) for c in self.__cpus] self.__sparse = True if self.__run_on_isolcpus:
@@ -220,7 +220,7 @@ class Cyclictest(rtevalModulePrototype): self.__cpus = [c for c in self.__cpus if c in cpuset or self.__run_on_isolcpus and c in isolcpus] if self.__run_on_isolcpus: self.__sparse = True - self.__cpulist = CpuList.collapse_cpulist([int(c) for c in self.__cpus]) + self.__cpulist = cpulist_utils.collapse_cpulist([int(c) for c in self.__cpus]) # Sort the list of cpus to align with the order reported by cyclictest self.__cpus.sort(key=int)
rteval/systopology.py +12 -150
219 lines not on this page · raw message
Signature · 1 line
2.41.0