Skip to content

Commit

Permalink
avocado/utils/cpu.py: add getting physical core from lscpu
Browse files Browse the repository at this point in the history
This patch adds support for getting number of physical cores
present in a lpar from lscpu. This is useful for running perf 24x7
events which requires this value with domain parameter.

Signed-off-by: Disha Goel <[email protected]>
  • Loading branch information
disgoel committed Apr 24, 2024
1 parent 1c66ae2 commit 0e79149
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion avocado/utils/cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,8 +634,10 @@ def lscpu():
output = process.run("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())
if "Core(s) per socket:" in line:
res["cores"] = int(line.split(":")[1].strip())
res["virtual_cores"] = int(line.split(":")[1].strip())
if "Physical sockets:" in line:
res["physical_sockets"] = int(line.split(":")[1].strip())
if "Physical chips:" in line:
Expand Down

0 comments on commit 0e79149

Please sign in to comment.