[PATCH v1] framework: fix getting single cpu information on freebsd
Daxue Gao
daxuex.gao at intel.com
Thu Jun 1 08:01:25 CEST 2023
Fix to get cpu information on freebsd,
when the machine has only one cpu,
It cannot match the number of cpus,cores,threads.
Such as:
<groups>
<group level="1" cache-level="0">
<cpu count="8" mask="ff,0,0,0">0, 1, 2, 3, 4, 5, 6, 7</cpu>
</group>
</groups>
Signed-off-by: Daxue Gao <daxuex.gao at intel.com>
---
framework/crb.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/framework/crb.py b/framework/crb.py
index 4ffee558..9e3b0a58 100644
--- a/framework/crb.py
+++ b/framework/crb.py
@@ -721,9 +721,21 @@ class Crb(object):
socket_id = 0
sockets = cpu_xml.findall(".//group[@level='2']")
+ if not sockets:
+ sockets = cpu_xml.findall(".//group[@level='1']")
for socket in sockets:
core_id = 0
core_elements = socket.findall(".//children/group/cpu")
+ if not core_elements:
+ core_elements = socket.findall("./cpu")
+ for core in core_elements:
+ cores = [int(x) for x in core.text.split(",")]
+ for core in cores:
+ if self.crb["bypass core0"] and core == 0:
+ continue
+ self.cores.append(
+ {"socket": socket_id, "core": core, "thread": core}
+ )
for core in core_elements:
threads = [int(x) for x in core.text.split(",")]
for thread in threads:
--
2.17.1
More information about the dts
mailing list