mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-21 19:02:25 +00:00
cpu-gather: Move cpuid call to new script
Turn the comment on how to aquire cpuid into a runtime error message. Use "http" instead of "https" in the URL, as the latter is broken. Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
d200908844
commit
7721aae31b
@ -18,6 +18,25 @@ def gather_name(args):
|
||||
"Use '--model' to set a model name.")
|
||||
|
||||
|
||||
def gather_cpuid_leaves():
|
||||
try:
|
||||
output = subprocess.check_output(
|
||||
["cpuid", "-1r"],
|
||||
universal_newlines=True)
|
||||
except FileNotFoundError as e:
|
||||
exit("Error: '{}' not found.\n'cpuid' can be usually found in a "
|
||||
"package named identically. If your distro does not provide such "
|
||||
"package, you can find the sources or binary packages at "
|
||||
"'http://www.etallen.com/cpuid.html'.".format(e.filename))
|
||||
|
||||
for line in output.split("\n"):
|
||||
if not line:
|
||||
continue
|
||||
if line == "CPU:":
|
||||
continue
|
||||
yield line.strip()
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Gather cpu test data")
|
||||
parser.add_argument(
|
||||
@ -30,6 +49,12 @@ def main():
|
||||
name = gather_name(args)
|
||||
print("model name\t: {}".format(name))
|
||||
|
||||
leaves = gather_cpuid_leaves()
|
||||
print("CPU:")
|
||||
for leave in leaves:
|
||||
print(" {}".format(leave))
|
||||
print()
|
||||
|
||||
print(end="", flush=True)
|
||||
os.environ["CPU_GATHER_PY"] = "true"
|
||||
subprocess.check_call("./cpu-gather.sh")
|
||||
|
@ -1,17 +1,10 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# The cpuid tool can be usually found in a package called "cpuid". If your
|
||||
# distro does not provide such package, you can find the sources or binary
|
||||
# packages at https://www.etallen.com/cpuid.html
|
||||
|
||||
if [ -z "${CPU_GATHER_PY}" ]; then
|
||||
echo >&2 "Do not call this script directly. Use 'cpu-gather.py' instead."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cpuid -1r
|
||||
echo
|
||||
|
||||
python3 <<EOF
|
||||
from struct import pack, unpack
|
||||
from fcntl import ioctl
|
||||
|
Loading…
x
Reference in New Issue
Block a user