mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-07-30 21:47:18 +00:00
cpu-gather: Move simple model extraction to new script
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
afbb7af3ca
commit
92a989b9d4
@ -115,6 +115,63 @@ def gather_static_model(args):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def gather_full_model(args, static_model):
|
||||||
|
if static_model:
|
||||||
|
return []
|
||||||
|
else:
|
||||||
|
return call_qemu(args.path_to_qemu, [
|
||||||
|
{
|
||||||
|
"execute": "qom-get",
|
||||||
|
"arguments":
|
||||||
|
{
|
||||||
|
"path": "/machine/unattached/device[0]",
|
||||||
|
"property": "feature-words"
|
||||||
|
},
|
||||||
|
"id": "feature-words"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"execute": "qom-get",
|
||||||
|
"arguments":
|
||||||
|
{
|
||||||
|
"path": "/machine/unattached/device[0]",
|
||||||
|
"property": "family"
|
||||||
|
},
|
||||||
|
"id": "family"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"execute": "qom-get",
|
||||||
|
"arguments":
|
||||||
|
{
|
||||||
|
"path": "/machine/unattached/device[0]",
|
||||||
|
"property": "model"
|
||||||
|
},
|
||||||
|
"id": "model"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"execute": "qom-get",
|
||||||
|
"arguments":
|
||||||
|
{
|
||||||
|
"path": "/machine/unattached/device[0]",
|
||||||
|
"property": "stepping"
|
||||||
|
},
|
||||||
|
"id": "stepping"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"execute": "qom-get",
|
||||||
|
"arguments":
|
||||||
|
{
|
||||||
|
"path": "/machine/unattached/device[0]",
|
||||||
|
"property": "model-id"
|
||||||
|
},
|
||||||
|
"id": "model-id"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"execute": "query-cpu-definitions",
|
||||||
|
"id": "definitions"
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description="Gather cpu test data")
|
parser = argparse.ArgumentParser(description="Gather cpu test data")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@ -161,6 +218,9 @@ def main():
|
|||||||
print(" 0x{:x}: 0x{:016x}\n".format(int(key), value))
|
print(" 0x{:x}: 0x{:016x}\n".format(int(key), value))
|
||||||
|
|
||||||
static_model = gather_static_model(args)
|
static_model = gather_static_model(args)
|
||||||
|
model = gather_full_model(args, static_model)
|
||||||
|
for o in model:
|
||||||
|
print(json.dumps(o))
|
||||||
|
|
||||||
print(end="", flush=True)
|
print(end="", flush=True)
|
||||||
os.environ["CPU_GATHER_PY"] = "true"
|
os.environ["CPU_GATHER_PY"] = "true"
|
||||||
|
@ -5,13 +5,6 @@ if [ -z "${CPU_GATHER_PY}" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
qom_get()
|
|
||||||
{
|
|
||||||
path='/machine/unattached/device[0]'
|
|
||||||
echo '{"execute":"qom-get","arguments":{"path":"'$path'",' \
|
|
||||||
'"property":"'$1'"},"id":"'$1'"}'
|
|
||||||
}
|
|
||||||
|
|
||||||
model_expansion()
|
model_expansion()
|
||||||
{
|
{
|
||||||
mode=$1
|
mode=$1
|
||||||
@ -26,12 +19,6 @@ $qemu -machine accel=kvm -cpu host -nodefaults -nographic -qmp stdio <<EOF
|
|||||||
$(
|
$(
|
||||||
if [ "x$model" != x ]; then
|
if [ "x$model" != x ]; then
|
||||||
model_expansion full "$model"
|
model_expansion full "$model"
|
||||||
else
|
|
||||||
qom_get feature-words
|
|
||||||
qom_get family
|
|
||||||
qom_get model
|
|
||||||
qom_get stepping
|
|
||||||
qom_get model-id
|
|
||||||
fi
|
fi
|
||||||
)
|
)
|
||||||
{"execute":"query-cpu-definitions","id":"definitions"}
|
{"execute":"query-cpu-definitions","id":"definitions"}
|
||||||
|
Loading…
Reference in New Issue
Block a user