qga: implement a 'guest-get-load' command
authorDaniel P. Berrangé <berrange@redhat.com>
Mon, 2 Dec 2024 12:19:27 +0000 (12:19 +0000)
committerKonstantin Kostiuk <kkostiuk@redhat.com>
Mon, 6 Jan 2025 10:48:46 +0000 (12:48 +0200)
commit5288d9d0853622668bd293023d2dfe200f3606f1
treebe6982277bb59e6d19c32007fd5c1d6838507efa
parent9ee90cfc25747ab25c7da31a50f167fc5122e20e
qga: implement a 'guest-get-load' command

Provide a way to report the process load average, via a new
'guest-get-load' command.

This is only implemented for POSIX platforms providing 'getloadavg'.

Example illustrated with qmp-shell:

(QEMU) guest-get-load
{
    "return": {
        "load15m": 1.546875,
        "load1m": 1.669921875,
        "load5m": 1.9306640625
    }
}

Windows has no native equivalent API, but it would be possible to
simulate it as illustrated here (BSD-3-Clause):

  https://github.com/giampaolo/psutil/pull/1485

This is left as an exercise for future contributors.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>
Message-ID: <20241202121927.864335-1-berrange@redhat.com>
Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
meson.build
qga/commands-posix.c
qga/qapi-schema.json