From: Tomas Glozar <tglozar@redhat.com>
To: linux-rt-users@vger.kernel.org
Cc: Tomas Glozar <tglozar@redhat.com>
Subject: [PATCH 2/6] rteval: Report isolated CPUs
Date: Fri, 30 Jun 2023 11:19:03 +0200 [thread overview]
Message-ID: <20230630091951.916865-3-tglozar@redhat.com> (raw)
In-Reply-To: <20230630091951.916865-1-tglozar@redhat.com>
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>
---
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
next prev parent reply other threads:[~2023-06-30 9:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-30 9:19 [PATCH 0/6] rteval: Handle isolcpus correctly Tomas Glozar
2023-06-30 9:19 ` [PATCH 1/6] rteval: Detect isolcpus in systopology Tomas Glozar
2023-07-25 13:33 ` John Kacur
2023-07-25 13:36 ` John Kacur
2023-06-30 9:19 ` Tomas Glozar [this message]
2023-07-25 13:38 ` [PATCH 2/6] rteval: Report isolated CPUs John Kacur
2023-06-30 9:19 ` [PATCH 3/6] rteval: Exclude isolcpus from kcompile by default Tomas Glozar
2023-07-25 13:40 ` John Kacur
2023-06-30 9:19 ` [PATCH 4/6] rteval: Exclude isolcpus from stressng " Tomas Glozar
2023-07-25 13:42 ` John Kacur
2023-06-30 9:19 ` [PATCH 5/6] rteval: Fix CPU count calculation for hackbench Tomas Glozar
2023-07-25 13:44 ` John Kacur
2023-06-30 9:19 ` [PATCH 6/6] rteval: Exclude isolcpus from loads report Tomas Glozar
2023-07-25 14:32 ` John Kacur
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230630091951.916865-3-tglozar@redhat.com \
--to=tglozar@redhat.com \
--cc=linux-rt-users@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).