qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH v2 3/5] virtio-balloon: Add QMP functions for Working Set


From: David Hildenbrand
Subject: Re: [RFC PATCH v2 3/5] virtio-balloon: Add QMP functions for Working Set
Date: Wed, 31 May 2023 10:14:37 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0

On 26.05.23 00:20, T.J. Alumbaugh wrote:
   - 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
     }
   }
}

Would it be possible to model that as QOM property instead? Then, we could use qom-get/qom-set on the device instead of having to craft new QMP/HMP functions.

--
Thanks,

David / dhildenb




reply via email to

[Prev in Thread] Current Thread [Next in Thread]