"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(
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")
#!/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