[v1] framework: fix getting single cpu information on freebsd
Checks
Context |
Check |
Description |
ci/Intel-dts-format-test |
success
|
Testing OK
|
ci/Intel-dts-pylama-test |
success
|
Testing OK
|
ci/Intel-dts-suite-test |
success
|
Testing OK
|
Commit Message
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@intel.com>
---
framework/crb.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
Comments
On Thu, 1 Jun 2023 14:01:25 +0800, Daxue Gao <daxuex.gao@intel.com> wrote:
> 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@intel.com>
Acked-by: Lijuan Tu <lijuan.tu@intel.com>
Applied, thanks
@@ -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: