diff mbox series

[5/6] rteval: Fix CPU count calculation for hackbench

Message ID 20230630091951.916865-6-tglozar@redhat.com
State New
Headers show
Series rteval: Handle isolcpus correctly | expand

Commit Message

Tomas Glozar June 30, 2023, 9:19 a.m. UTC
Use count from cpulist when specified and all CPUs on node excluding
offline ones and isolated ones if not specified.

Signed-off-by: Tomas Glozar <tglozar@redhat.com>
---
 rteval/modules/loads/hackbench.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

John Kacur July 25, 2023, 1:44 p.m. UTC | #1
On Fri, 30 Jun 2023, Tomas Glozar wrote:

> Use count from cpulist when specified and all CPUs on node excluding
> offline ones and isolated ones if not specified.
> 
> Signed-off-by: Tomas Glozar <tglozar@redhat.com>
> ---
>  rteval/modules/loads/hackbench.py | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/rteval/modules/loads/hackbench.py b/rteval/modules/loads/hackbench.py
> index 14e60d1..f5a547e 100644
> --- a/rteval/modules/loads/hackbench.py
> +++ b/rteval/modules/loads/hackbench.py
> @@ -38,6 +38,7 @@ from rteval.Log import Log
>  from rteval.systopology import CpuList, SysTopology
>  
>  expand_cpulist = CpuList.expand_cpulist
> +isolated_cpulist = CpuList.isolated_cpulist
>  
>  class Hackbench(CommandLineLoad):
>      def __init__(self, config, logger):
> @@ -77,9 +78,12 @@ class Hackbench(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)]
> +            # if a cpulist was not specified, exclude isolated cpus
> +            else:
> +                self.cpus[n] = CpuList.nonisolated_cpulist(self.cpus[n])
>  
>              # track largest number of cpus used on a node
> -            node_biggest = len(sysTop.getcpus(int(n)))
> +            node_biggest = len(self.cpus[n])
>              if node_biggest > biggest:
>                  biggest = node_biggest
>  
> -- 
> 2.41.0
> 
> 

Signed-off-by: John Kacur <jkacur@redhat.com>
diff mbox series

Patch

diff --git a/rteval/modules/loads/hackbench.py b/rteval/modules/loads/hackbench.py
index 14e60d1..f5a547e 100644
--- a/rteval/modules/loads/hackbench.py
+++ b/rteval/modules/loads/hackbench.py
@@ -38,6 +38,7 @@  from rteval.Log import Log
 from rteval.systopology import CpuList, SysTopology
 
 expand_cpulist = CpuList.expand_cpulist
+isolated_cpulist = CpuList.isolated_cpulist
 
 class Hackbench(CommandLineLoad):
     def __init__(self, config, logger):
@@ -77,9 +78,12 @@  class Hackbench(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)]
+            # if a cpulist was not specified, exclude isolated cpus
+            else:
+                self.cpus[n] = CpuList.nonisolated_cpulist(self.cpus[n])
 
             # track largest number of cpus used on a node
-            node_biggest = len(sysTop.getcpus(int(n)))
+            node_biggest = len(self.cpus[n])
             if node_biggest > biggest:
                 biggest = node_biggest