From 0e79149de0a4b5185bc6f04d8aecd623e059cd02 Mon Sep 17 00:00:00 2001 From: Disha Goel Date: Thu, 25 Apr 2024 00:00:14 +0530 Subject: [PATCH] avocado/utils/cpu.py: add getting physical core from lscpu 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 --- avocado/utils/cpu.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/avocado/utils/cpu.py b/avocado/utils/cpu.py index dbe1f32cbb..319bdc37d2 100644 --- a/avocado/utils/cpu.py +++ b/avocado/utils/cpu.py @@ -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: