rteval/rteval-Report-isolated-CPUs.patch
Tomas Glozar 0ab8938885 Added patch set that enables rteval to do load calculations and
reporting correctly on systems with isolated CPUs

jiraProject== RHEL-8681

Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2023-10-05 09:11:46 +02:00

84 lines
3.1 KiB
Diff

From cb7ba0c0db7631021341b7fa692c286fd9d33cd1 Mon Sep 17 00:00:00 2001
From: Tomas Glozar <tglozar@redhat.com>
Date: Fri, 30 Jun 2023 11:19:03 +0200
Subject: [PATCH] rteval: Report isolated CPUs
Add a flag for whether a CPU is isolated in CPUtopology and display
the number of isolated CPUs in text report.
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
rteval/rteval_text.xsl | 4 ++++
rteval/sysinfo/cputopology.py | 11 +++++++++++
2 files changed, 15 insertions(+)
diff --git a/rteval/rteval_text.xsl b/rteval/rteval_text.xsl
index 7ecfac6..0ef649b 100644
--- a/rteval/rteval_text.xsl
+++ b/rteval/rteval_text.xsl
@@ -59,6 +59,10 @@
<xsl:value-of select="SystemInfo/CPUtopology/@num_cpu_cores"/>
<xsl:text> (online: </xsl:text>
<xsl:value-of select="SystemInfo/CPUtopology/@num_cpu_cores_online"/>
+ <xsl:if test="SystemInfo/CPUtopology/@num_cpu_cores_isolated != 0">
+ <xsl:text>, isolated: </xsl:text>
+ <xsl:value-of select="SystemInfo/CPUtopology/@num_cpu_cores_isolated"/>
+ </xsl:if>
<xsl:text>)</xsl:text>
</xsl:when>
<xsl:when test="hardware/cpu_topology">
diff --git a/rteval/sysinfo/cputopology.py b/rteval/sysinfo/cputopology.py
index 2bb6323..f60b059 100644
--- a/rteval/sysinfo/cputopology.py
+++ b/rteval/sysinfo/cputopology.py
@@ -25,6 +25,7 @@
import os
import libxml2
+from rteval.systopology import SysTopology
class CPUtopology:
"Retrieves an overview over the installed CPU cores and the system topology"
@@ -34,6 +35,7 @@ class CPUtopology:
self.__cputop_n = None
self.__cpu_cores = 0
self.__online_cores = 0
+ self.__isolated_cores = 0
self.__cpu_sockets = 0
def __read(self, dirname, fname):
@@ -51,6 +53,10 @@ class CPUtopology:
self.__cputop_n = libxml2.newNode('CPUtopology')
+ # Get list of isolated CPUs from SysTopology
+ systopology = SysTopology()
+ isolated_cpus = {'cpu' + n for n in systopology.isolated_cpus_str()}
+
cpusockets = []
for dirname in os.listdir(self.sysdir):
# Only parse directories which starts with 'cpu'
@@ -82,6 +88,10 @@ class CPUtopology:
'physical_package_id')
cpu_n.newProp('physical_package_id', str(phys_pkg_id))
cpusockets.append(phys_pkg_id)
+ is_isolated = dirname in isolated_cpus
+ if is_isolated:
+ self.__isolated_cores += 1
+ cpu_n.newProp('isolated', str(int(dirname in isolated_cpus)))
break
# Count unique CPU sockets
@@ -97,6 +107,7 @@ class CPUtopology:
# Summarise the core counts
self.__cputop_n.newProp('num_cpu_cores', str(self.__cpu_cores))
self.__cputop_n.newProp('num_cpu_cores_online', str(self.__online_cores))
+ self.__cputop_n.newProp('num_cpu_cores_isolated', str(self.__isolated_cores))
self.__cputop_n.newProp('num_cpu_sockets', str(self.__cpu_sockets))
return self.__cputop_n
--
2.41.0