Skip to content

Commit

Permalink
Merge pull request avocado-framework#5947 from disgoel/fix-phy-core
Browse files Browse the repository at this point in the history
utils/cpu.py: fix commit 0e79149
  • Loading branch information
PraveenPenguin authored Jun 8, 2024
2 parents 69d34a9 + 524a705 commit 71c17ec
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion avocado/utils/cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ def lscpu():
res = {}
for line in output.stdout.decode("utf-8").split("\n"):
if "Physical cores/chip:" in line:
res["physical_cores"] = int(line.split(":")[1].strip())
res["cores_per_chip"] = int(line.split(":")[1].strip())
if "Core(s) per socket:" in line:
res["virtual_cores"] = int(line.split(":")[1].strip())
if "Physical sockets:" in line:
Expand All @@ -644,6 +644,14 @@ def lscpu():
res["physical_chips"] = int(line.split(":")[1].strip())
if "physical_sockets" in res and "physical_chips" in res:
res["chips"] = res["physical_sockets"] * res["physical_chips"]
if (
"physical_sockets" in res
and "physical_chips" in res
and "cores_per_chip" in res
):
res["physical_cores"] = (
res["physical_sockets"] * res["physical_chips"] * res["cores_per_chip"]
)
return res


Expand Down

0 comments on commit 71c17ec

Please sign in to comment.