cpu-gather: Move model_name to new script

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Tim Wiederhake 2020-12-15 17:24:49 +01:00 committed by Michal Privoznik
parent 34c9db5a4a
commit a3a3a929c4
2 changed files with 13 additions and 2 deletions

View File

@ -4,7 +4,20 @@ import os
import subprocess
def gather_name():
with open("/proc/cpuinfo", "rt") as f:
for line in f.readlines():
if line.startswith("model name"):
return line.split(":", 2)[1].strip()
exit("Error: '/proc/cpuinfo' does not contain a model name.")
def main():
name = gather_name()
print("model name\t: {}".format(name))
print(end="", flush=True)
os.environ["CPU_GATHER_PY"] = "true"
subprocess.check_call("./cpu-gather.sh")

View File

@ -9,8 +9,6 @@ if [ -z "${CPU_GATHER_PY}" ]; then
exit 1
fi
grep 'model name' /proc/cpuinfo | head -n1
cpuid -1r
echo