[PATCH 2/6] rteval: Report isolated CPUs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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




[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux