From nobody Mon Feb 9 07:31:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=bytedance.com ARC-Seal: i=1; a=rsa-sha256; t=1657156069; cv=none; d=zohomail.com; s=zohoarc; b=ifmv/7IKViLXivsjcro3KocXHPxQfCOfuKXXv0zGTv4JrDVIx7mT2w3g8gl5+gfYw6r+R5f/+4bXBbAxuTe5XBHZH5zrfc6/zAbcJlpZhISmAlbAqze/xXUY8VGoRuLpkWn1LFFWnilzvBuI1CdVQqeQg4YSovkyqSiNqwt1cqU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1657156069; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ciy/rVsUfuCzRTIRDYNTp21K1MImnDH8PNlQB0j83jA=; b=KYuOgolpssDLIvRFQ/XEdRjAwWjBh+C2S3BN4kVjrrVBoto23CoExKUB8Tfrblcd6hAscjR3VWpTehhFQGzHchHymucCaJE66KQMpboUEBVkonbG+4ZPkWyjmq5eNP3wrkZr4Q/liCXKhL6W7qpKoMiZfnNCFIZ77UdPV3Jr5l8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1657156069406358.9632693500271; Wed, 6 Jul 2022 18:07:49 -0700 (PDT) Received: from localhost ([::1]:48496 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o9Fzf-0000t2-O3 for importer@patchew.org; Wed, 06 Jul 2022 21:07:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9FtJ-0002tc-Q2 for qemu-devel@nongnu.org; Wed, 06 Jul 2022 21:01:13 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]:45841) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o9FtE-0000Qm-5r for qemu-devel@nongnu.org; Wed, 06 Jul 2022 21:01:09 -0400 Received: by mail-pg1-x52d.google.com with SMTP id 145so15643356pga.12 for ; Wed, 06 Jul 2022 18:01:04 -0700 (PDT) Received: from always-x1.bytedance.net ([61.120.150.70]) by smtp.gmail.com with ESMTPSA id 7-20020a620607000000b00528c26c84a3sm982445pfg.64.2022.07.06.18.01.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 18:01:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ciy/rVsUfuCzRTIRDYNTp21K1MImnDH8PNlQB0j83jA=; b=4gCeWOPDzggRrt8xQiE5SvC83J+XsDSfeUlu5bAERZJNq/HssMEJ7zJc6AbRyjcxSl Cp9AcUG6ujl/I8cCo4Q1nQgeUyf2lZAhD51h+lu5jFYeYclZHFW2LAoYvz6c/rdsHv6O 3bNuybFCynlFyoD1PzBdAhz6T1WZ7fzh/BOtph59+U7o6SOwUIv7yQ9kTHnFJgO8RavT BLENsgFp8Xgc0YfWP77xsA5Upbay24Whz2y/29U98CCEQonmtGjtiiI6UpfNRubKcvgc gfQPdzzjbCdhxJlpwuQ+bsLq1x4ibyaBFJGtTpxn6+/qfrvqod2FHs57urIey/YzsqBf 2TEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ciy/rVsUfuCzRTIRDYNTp21K1MImnDH8PNlQB0j83jA=; b=kuHuLoLQs7PgDe8Urrl6Ycy9AOT10X5JK8ESThO9wZjOXBhX/S9bPg6TffCnIZTDV4 /WvvL4Dxnoqzwq7Mn0iKi5ZkaU+JE5ynXOHscE95WEnNHOz209MODzzr5Xe/3U+pAsND mIJLIcv4H2g4GOJWvsDesrRBnf84W5beCHbshqEXKXJCk6a72VIUOBR1f9yI94BpzcCS dKx/AfBwNfEiwR4LE+hnAeLv5TgaHx7BdpPqVvJhy4iL0kMBa25FYCNIyLpGVI2ZlnWb W7aXaou2j54bzR6PsKNLaPxFdydAePY634O8Mrl9/tFT6M7HxlEGSBLp6pyRnsEVY6qa MCJQ== X-Gm-Message-State: AJIora/V6nxBME3Q6eQe4JtMvfcZ+PxElsjtTHkmoVaWWEl0qfncCFDU UlsGgtsdbkUr/HmjhACVCm00pQ== X-Google-Smtp-Source: AGRyM1vknaT19jo25gJa7nw8cgf9A3HSlwZgQdUcv/DuMr8Bqt6QKE73xpbBlrkIXpuY8iOrHPvdMA== X-Received: by 2002:a63:87c6:0:b0:411:6ef7:ca80 with SMTP id i189-20020a6387c6000000b004116ef7ca80mr36039730pge.580.1657155663538; Wed, 06 Jul 2022 18:01:03 -0700 (PDT) From: zhenwei pi To: michael.roth@amd.com, kkostiuk@redhat.com, marcandre.lureau@redhat.com, armbru@redhat.com Cc: qemu-devel@nongnu.org, zhenwei pi Subject: [PATCH v4 1/2] qapi: Avoid generating C identifier 'linux' Date: Thu, 7 Jul 2022 08:56:01 +0800 Message-Id: <20220707005602.696557-2-pizhenwei@bytedance.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220707005602.696557-1-pizhenwei@bytedance.com> References: <20220707005602.696557-1-pizhenwei@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::52d; envelope-from=pizhenwei@bytedance.com; helo=mail-pg1-x52d.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @bytedance-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1657156071090100001 'linux' is not usable as identifier, because C compilers targeting Linux predefine it as a macro expanding to 1. Add it to @polluted_words. 'unix' is already there. Suggested-by: Markus Armbruster Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: zhenwei pi Reviewed-by: Markus Armbruster --- scripts/qapi/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py index 489273574a..737b059e62 100644 --- a/scripts/qapi/common.py +++ b/scripts/qapi/common.py @@ -114,7 +114,7 @@ def c_name(name: str, protect: bool =3D True) -> str: 'and', 'and_eq', 'bitand', 'bitor', 'compl', 'not', 'not_eq', 'or', 'or_eq', 'xor', 'xor_eq']) # namespace pollution: - polluted_words =3D set(['unix', 'errno', 'mips', 'sparc', 'i386']) + polluted_words =3D set(['unix', 'errno', 'mips', 'sparc', 'i386', 'lin= ux']) name =3D re.sub(r'[^A-Za-z0-9_]', '_', name) if protect and (name in (c89_words | c99_words | c11_words | gcc_words | cpp_words | polluted_words) --=20 2.20.1 From nobody Mon Feb 9 07:31:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=bytedance.com ARC-Seal: i=1; a=rsa-sha256; t=1657155790; cv=none; d=zohomail.com; s=zohoarc; b=Hv8ZKcbuDsacfiKqQExuL0f7xScWgarfPWFJ3zxryCpFD6gG/6POLO37rWkSHD/tFGI4CA7gXCr/22QYXjlevtmkTAwZNnsfVWPCSyGzMTpMC5qDSY3yyWJXTWqJWB13DBVnEJFYo5arvOWTtmMMC/NyOGboBXSiQtY0CB5GVTk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1657155790; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=IhCxsYSHLosXl7V9PSYQ6mQg0PRKB1tVYcws6yF4v4k=; b=mKDyw1lUpe+CI48kKB20k5tnabsN6VDVhBcxcJv68TgvRT86m5TGss2j7k3SPFNyckHkROrKIJyrg+NQ033zw1jHlmG9NKgG2W1rby3n0LCorOjRCklKMAeXrLo6bgr4Qv1PMgraGqXuBeF12VnYs1YFxCIFvfkZbsTtpvh896w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1657155790386930.4237754176633; Wed, 6 Jul 2022 18:03:10 -0700 (PDT) Received: from localhost ([::1]:40950 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o9FvA-00047G-Mw for importer@patchew.org; Wed, 06 Jul 2022 21:03:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34400) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9FtJ-0002te-KY for qemu-devel@nongnu.org; Wed, 06 Jul 2022 21:01:13 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]:33721) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o9FtE-0000R2-M2 for qemu-devel@nongnu.org; Wed, 06 Jul 2022 21:01:10 -0400 Received: by mail-pf1-x436.google.com with SMTP id n12so16303026pfq.0 for ; Wed, 06 Jul 2022 18:01:08 -0700 (PDT) Received: from always-x1.bytedance.net ([61.120.150.70]) by smtp.gmail.com with ESMTPSA id 7-20020a620607000000b00528c26c84a3sm982445pfg.64.2022.07.06.18.01.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 18:01:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IhCxsYSHLosXl7V9PSYQ6mQg0PRKB1tVYcws6yF4v4k=; b=GrQOhDXoofmaI+yDVyZfovbBZsbC+6R2B3dqpoZIpCZkwM8Lt+pZbkKNyDNalg/MuH zdL7gX4GYZhrZJomMS5nweoyk4KMrRQNk7EZJe9Nd3EIZWW2t243r2LGqRgoc9+2xvQG 42CXmlSXu+t8HGUcbr5L58LttQlRInmPAf/6F4v91XE77VdNPGV6Pxho0LOQcBwLj3fj a/nOLDpqOCVZPC6+h+7iGUhB/XMv0sFI/+BFzfIIXc93GBaHn88ODj6/1geX6aV3A4yV 8zwplZr9boOmSnG5GQdj05NA/4T+luH80ZOCRSLK6fadYNaQY2yYRMxGkrFlRrpCPWSD Q0Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IhCxsYSHLosXl7V9PSYQ6mQg0PRKB1tVYcws6yF4v4k=; b=3pYX7IbXzH1UJhFI4p1A4o6Bwk1bAsnVH3EH7dFyhtuWqKNj3S/aqPSAgFhrDpAgXH X0dduCA5XPMEltXsrWPlR669HvOH22hsGCsy+sQz5WU/Kce5bxoFJMi2Ikbax1hADNMn I9p+bVyOsza5608jZIG53kdCe7jQCskIBGwv/W2q3iNco+5SJPzHvcesMEilO+nDALwE slmdw/j6+XvMndm9+VhObM9dZs1KSYakflssgG2/udqRh+u070HQSOkZ2hN0EsRWl+9J vjzhDaAqhytnjC+V1nOHKbs/mQ4c//4Z3+KFtQlFjf34gJr5XD2Zr+igY5f2puTO3zNm DMrQ== X-Gm-Message-State: AJIora833JCqNtexq4JXDaCkoSvzZngRrcfef72uKDy45VayHOv2Zfg2 5Al9wkqb2IGeIDZY3tBamNvrjw== X-Google-Smtp-Source: AGRyM1stUtMigCHSX434iH5is9SQ77A5dM6pnKI/1P303bDKZ4yOW//N2WCq/e6ggEZXwu8txQO/xg== X-Received: by 2002:a63:5121:0:b0:412:6f70:53e8 with SMTP id f33-20020a635121000000b004126f7053e8mr10224086pgb.68.1657155667372; Wed, 06 Jul 2022 18:01:07 -0700 (PDT) From: zhenwei pi To: michael.roth@amd.com, kkostiuk@redhat.com, marcandre.lureau@redhat.com, armbru@redhat.com Cc: qemu-devel@nongnu.org, zhenwei pi Subject: [PATCH v4 2/2] qga: add command 'guest-get-cpustats' Date: Thu, 7 Jul 2022 08:56:02 +0800 Message-Id: <20220707005602.696557-3-pizhenwei@bytedance.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220707005602.696557-1-pizhenwei@bytedance.com> References: <20220707005602.696557-1-pizhenwei@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=pizhenwei@bytedance.com; helo=mail-pf1-x436.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @bytedance-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1657155794498100001 A vCPU thread always reaches 100% utilization when: - guest uses idle=3Dpoll - disable HLT vm-exit - enable MWAIT Add new guest agent command 'guest-get-cpustats' to get guest CPU statistics, we can know the guest workload and how busy the CPU is. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: zhenwei pi Reviewed-by: Konstantin Kostiuk --- qga/commands-posix.c | 89 ++++++++++++++++++++++++++++++++++++++++++++ qga/commands-win32.c | 6 +++ qga/qapi-schema.json | 81 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 176 insertions(+) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 0469dc409d..f18530d85f 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -2893,6 +2893,90 @@ GuestDiskStatsInfoList *qmp_guest_get_diskstats(Erro= r **errp) return guest_get_diskstats(errp); } =20 +GuestCpuStatsList *qmp_guest_get_cpustats(Error **errp) +{ + GuestCpuStatsList *head =3D NULL, **tail =3D &head; + const char *cpustats =3D "/proc/stat"; + int clk_tck =3D sysconf(_SC_CLK_TCK); + FILE *fp; + size_t n; + char *line =3D NULL; + + fp =3D fopen(cpustats, "r"); + if (fp =3D=3D NULL) { + error_setg_errno(errp, errno, "open(\"%s\")", cpustats); + return NULL; + } + + while (getline(&line, &n, fp) !=3D -1) { + GuestCpuStats *cpustat =3D NULL; + GuestLinuxCpuStats *linuxcpustat; + int i; + unsigned long user, system, idle, iowait, irq, softirq, steal, gue= st; + unsigned long nice, guest_nice; + char name[64]; + + i =3D sscanf(line, "%s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu", + name, &user, &nice, &system, &idle, &iowait, &irq, &sof= tirq, + &steal, &guest, &guest_nice); + + /* drop "cpu 1 2 3 ...", get "cpuX 1 2 3 ..." only */ + if ((i =3D=3D EOF) || strncmp(name, "cpu", 3) || (name[3] =3D=3D '= \0')) { + continue; + } + + if (i < 5) { + slog("Parsing cpu stat from %s failed, see \"man proc\"", cpus= tats); + break; + } + + cpustat =3D g_new0(GuestCpuStats, 1); + cpustat->type =3D GUEST_CPU_STATS_TYPE_LINUX; + + linuxcpustat =3D &cpustat->u.q_linux; + linuxcpustat->cpu =3D atoi(&name[3]); + linuxcpustat->user =3D user * 1000 / clk_tck; + linuxcpustat->nice =3D nice * 1000 / clk_tck; + linuxcpustat->system =3D system * 1000 / clk_tck; + linuxcpustat->idle =3D idle * 1000 / clk_tck; + + if (i > 5) { + linuxcpustat->has_iowait =3D true; + linuxcpustat->iowait =3D iowait * 1000 / clk_tck; + } + + if (i > 6) { + linuxcpustat->has_irq =3D true; + linuxcpustat->irq =3D irq * 1000 / clk_tck; + linuxcpustat->has_softirq =3D true; + linuxcpustat->softirq =3D softirq * 1000 / clk_tck; + } + + if (i > 8) { + linuxcpustat->has_steal =3D true; + linuxcpustat->steal =3D steal * 1000 / clk_tck; + } + + if (i > 9) { + linuxcpustat->has_guest =3D true; + linuxcpustat->guest =3D guest * 1000 / clk_tck; + } + + if (i > 10) { + linuxcpustat->has_guest =3D true; + linuxcpustat->guest =3D guest * 1000 / clk_tck; + linuxcpustat->has_guestnice =3D true; + linuxcpustat->guestnice =3D guest_nice * 1000 / clk_tck; + } + + QAPI_LIST_APPEND(tail, cpustat); + } + + free(line); + fclose(fp); + return head; +} + #else /* defined(__linux__) */ =20 void qmp_guest_suspend_disk(Error **errp) @@ -3247,6 +3331,11 @@ GuestDiskStatsInfoList *qmp_guest_get_diskstats(Erro= r **errp) return NULL; } =20 +GuestCpuStatsList *qmp_guest_get_cpustats(Error **errp) +{ + error_setg(errp, QERR_UNSUPPORTED); + return NULL; +} =20 #endif /* CONFIG_FSFREEZE */ =20 diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 36f94c0f9c..7ed7664715 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -2543,3 +2543,9 @@ GuestDiskStatsInfoList *qmp_guest_get_diskstats(Error= **errp) error_setg(errp, QERR_UNSUPPORTED); return NULL; } + +GuestCpuStatsList *qmp_guest_get_cpustats(Error **errp) +{ + error_setg(errp, QERR_UNSUPPORTED); + return NULL; +} diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json index 9fa20e791b..869399ea1a 100644 --- a/qga/qapi-schema.json +++ b/qga/qapi-schema.json @@ -1576,3 +1576,84 @@ { 'command': 'guest-get-diskstats', 'returns': ['GuestDiskStatsInfo'] } + +## +# @GuestCpuStatsType: +# +# An enumeration of OS type +# +# Since: 7.1 +## +{ 'enum': 'GuestCpuStatsType', + 'data': [ 'linux' ] } + + +## +# @GuestLinuxCpuStats: +# +# CPU statistics of Linux +# +# @cpu: CPU index in guest OS +# +# @user: Time spent in user mode +# +# @nice: Time spent in user mode with low priority (nice) +# +# @system: Time spent in system mode +# +# @idle: Time spent in the idle task +# +# @iowait: Time waiting for I/O to complete (since Linux 2.5.41) +# +# @irq: Time servicing interrupts (since Linux 2.6.0-test4) +# +# @softirq: Time servicing softirqs (since Linux 2.6.0-test4) +# +# @steal: Stolen time by host (since Linux 2.6.11) +# +# @guest: ime spent running a virtual CPU for guest operating systems under +# the control of the Linux kernel (since Linux 2.6.24) +# +# @guestnice: Time spent running a niced guest (since Linux 2.6.33) +# +# Since: 7.1 +## +{ 'struct': 'GuestLinuxCpuStats', + 'data': {'cpu': 'int', + 'user': 'uint64', + 'nice': 'uint64', + 'system': 'uint64', + 'idle': 'uint64', + '*iowait': 'uint64', + '*irq': 'uint64', + '*softirq': 'uint64', + '*steal': 'uint64', + '*guest': 'uint64', + '*guestnice': 'uint64' + } } + +## +# @GuestCpuStats: +# +# Get statistics of each CPU in millisecond. +# +# - @linux: Linux style CPU statistics +# +# Since: 7.1 +## +{ 'union': 'GuestCpuStats', + 'base': { 'type': 'GuestCpuStatsType' }, + 'discriminator': 'type', + 'data': { 'linux': 'GuestLinuxCpuStats' } } + +## +# @guest-get-cpustats: +# +# Retrieve information about CPU stats. +# Returns: List of CPU stats of guest. +# +# Since: 7.1 +## +{ 'command': 'guest-get-cpustats', + 'returns': ['GuestCpuStats'] +} --=20 2.20.1