- Adds QMP function 'working-set-config'
- Adds QMP function 'working-set-request'
- Retrieve working set via 'guest-working-set' property on balloon
cat script.py
NAME = "name"
SOCKET = 'vm.sock'
BALLOON = "/machine/peripheral/balloon0"
import json
import asyncio
from qemu.qmp import QMPClient
async def main():
client = QMPClient(NAME)
await client.connect(SOCKET)
config = { "i0": 200, "i1": 800, "i2": 3000, "refresh": 750, "report":
1000 }
await client.execute('working-set-config', config)
await client.execute('working-set-request')
property = {"path":BALLOON, "property":"guest-working-set"}
res = await client.execute('qom-get', property)
return res
if __name__ == "__main__":
ret = asyncio.run(main())
print(json.dumps(ret, indent=2))
(Execute qemu with flag '-qmp unix:path=vm.sock,server=on,wait=off'
(Perform normal activities on VM to exercise MM code)
python3 script.py
{
"working_set": {
"ws3": {
"memory-size-bytes": {
"anon": 890478592,
"file": 1285832704
},
"idle-age": 4294967292
},
"ws2": {
"memory-size-bytes": {
"anon": 173465600,
"file": 83353600
},
"idle-age": 3000
},
"ws1": {
"memory-size-bytes": {
"anon": 44236800,
"file": 20889600
},
"idle-age": 800
},
"ws0": {
"memory-size-bytes": {
"anon": 14540800,
"file": 6963200
},
"idle-age": 200
}
}
}