From nobody Mon Feb 9 14:33:36 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=huawei.com ARC-Seal: i=1; a=rsa-sha256; t=1615898009; cv=none; d=zohomail.com; s=zohoarc; b=kNQLqLJeEA3iTTI8psLdvMAGtFj4bmwJ/JxTwv5SWcMtNig3R691bnV43VLufehTCKtj42AiorafpebPHwCnyAsR7TBYYZrSUOuFh7Rt/wUgC+BjBh6tOfknMuqJrwNCezC0SRFW8TNazP+N3Eik6ZzyurSaWwFVu7/8tZByGwI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615898009; 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=/OL/i6NKmLV+3c5jphJiRPV2EhYZcCboL2y1LvIET54=; b=IS3hCwRkXybL0UTXg9vCnaHOJbe4CFhrCrv/5MjTHw6k6t2Rx2P6FW9sVxGIR/UTqIF/roavSSpPhGPpeS38BMMKnHde9+vsLjb7OMrOM3mwAxvD311aWsdnrQC9ubbLF2cVN6tm7HfsTY2GGOt796Ch152CTBSr7yzEi6KL6FY= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1615898009404783.1817526420646; Tue, 16 Mar 2021 05:33:29 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-188-6deFXwOVOk-NjOJ5fIbzkw-1; Tue, 16 Mar 2021 08:33:24 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EB57A101F001; Tue, 16 Mar 2021 12:33:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BEBE81037E83; Tue, 16 Mar 2021 12:33:18 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 88AC618006D9; Tue, 16 Mar 2021 12:33:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12GCXFDr030730 for ; Tue, 16 Mar 2021 08:33:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id BCF751003209; Tue, 16 Mar 2021 12:33:15 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B8ADD10031EC for ; Tue, 16 Mar 2021 12:33:12 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AE7E580A1D2 for ; Tue, 16 Mar 2021 12:33:12 +0000 (UTC) Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-458-3UTjQQqnNcWr84iKsMnbiQ-1; Tue, 16 Mar 2021 08:33:07 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4F0CM20KvLz901m; Tue, 16 Mar 2021 20:31:10 +0800 (CST) Received: from huawei.com (10.175.104.175) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.498.0; Tue, 16 Mar 2021 20:32:56 +0800 X-MC-Unique: 6deFXwOVOk-NjOJ5fIbzkw-1 X-MC-Unique: 3UTjQQqnNcWr84iKsMnbiQ-1 From: Hao Wang To: Subject: [PATCH v7 7/7] migration/dirtyrate: Introduce command 'virsh domstats --dirtyrate' Date: Tue, 16 Mar 2021 20:32:51 +0800 Message-ID: <20210316123251.511485-8-wanghao232@huawei.com> In-Reply-To: <20210316123251.511485-1-wanghao232@huawei.com> References: <20210316123251.511485-1-wanghao232@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.104.175] X-CFilter-Loop: Reflected X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 12GCXFDr030730 X-loop: libvir-list@redhat.com Cc: yubihong@huawei.com, zhengchuan@huawei.com, pkrempa@redhat.com, zhang.zhanghailiang@huawei.com, mprivozn@redhat.com, danielhb413@gmail.com, xiexiangyou@huawei.com, alex.chen@huawei.com, wanghao232@huawei.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Introduce command 'virsh domstats --dirtyrate' for reporting memory dirty rate information. The info is listed as: Domain: 'vm0' dirtyrate.calc_status=3D2 dirtyrate.calc_start_time=3D1534523 dirtyrate.calc_period=3D1 dirtyrate.megabytes_per_second=3D5 Signed-off-by: Hao Wang --- docs/manpages/virsh.rst | 16 ++++++++++++++-- tools/virsh-domain-monitor.c | 7 +++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 367b4bddeb..813fb0bd60 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -2219,7 +2219,7 @@ domstats =20 domstats [--raw] [--enforce] [--backing] [--nowait] [--state] [--cpu-total] [--balloon] [--vcpu] [--interface] - [--block] [--perf] [--iothread] [--memory] + [--block] [--perf] [--iothread] [--memory] [--dirtyrate] [[--list-active] [--list-inactive] [--list-persistent] [--list-transient] [--list-running]y [--list-paused] [--list-shutoff] [--list-other]] | [domain ...] @@ -2238,7 +2238,8 @@ behavior use the *--raw* flag. The individual statistics groups are selectable via specific flags. By default all supported statistics groups are returned. Supported statistics groups flags are: *--state*, *--cpu-total*, *--balloon*, -*--vcpu*, *--interface*, *--block*, *--perf*, *--iothread*, *--memory*. +*--vcpu*, *--interface*, *--block*, *--perf*, *--iothread*, *--memory*, +*--dirtyrate*. =20 Note that - depending on the hypervisor type and version or the domain sta= te - not all of the following statistics may be returned. @@ -2435,6 +2436,17 @@ not available for statistical purposes. bytes consumed by @vcpus that passing through all memory controllers, ei= ther local or remote controller. =20 +*--dirtyrate* returns: + +* ``dirtyrate.calc_status`` - the status of last memory dirty rate + calculation, returned as number from virDomainDirtyRateStatus enum. +* ``dirtyrate.calc_start_time`` - the start time of last memory dirty + rate calculation. +* ``dirtyrate.calc_period`` - the period of last memory dirty rate + calculation. +* ``dirtyrate.megabytes_per_second`` - the calculated memory dirty + rate in MiB/s. + =20 Selecting a specific statistics groups doesn't guarantee that the daemon supports the selected group of stats. Flag *--enforce* diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 897339b6f9..c4d7464695 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -2148,6 +2148,10 @@ static const vshCmdOptDef opts_domstats[] =3D { .type =3D VSH_OT_BOOL, .help =3D N_("report domain memory usage"), }, + {.name =3D "dirtyrate", + .type =3D VSH_OT_BOOL, + .help =3D N_("report domain dirty rate information"), + }, {.name =3D "list-active", .type =3D VSH_OT_BOOL, .help =3D N_("list only active domains"), @@ -2267,6 +2271,9 @@ cmdDomstats(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptBool(cmd, "memory")) stats |=3D VIR_DOMAIN_STATS_MEMORY; =20 + if (vshCommandOptBool(cmd, "dirtyrate")) + stats |=3D VIR_DOMAIN_STATS_DIRTYRATE; + if (vshCommandOptBool(cmd, "list-active")) flags |=3D VIR_CONNECT_GET_ALL_DOMAINS_STATS_ACTIVE; =20 --=20 2.23.0