在 2022/2/21 20:34, Michal Prívozník 写道:
On 2/20/22 14:28, huangy81(a)chinatelecom.cn wrote:
> From: Hyman Huang(黄勇) <huangy81(a)chinatelecom.cn>
>
> Extend domdirtyrate-calc virsh api with mode option, either
> of these three options "page-sampling,dirty-bitmap,dirty-ring"
> can be specified when calculating dirty page rate.
>
> Signed-off-by: Hyman Huang(黄勇) <huangy81(a)chinatelecom.cn>
> ---
> docs/manpages/virsh.rst | 7 +++++--
> src/libvirt-domain.c | 12 +++++++++++-
> tools/virsh-completer-domain.c | 17 +++++++++++++++++
> tools/virsh-completer-domain.h | 4 ++++
> tools/virsh-domain.c | 42 +++++++++++++++++++++++++++++++++++++++++-
> tools/virsh-domain.h | 9 +++++++++
> 6 files changed, 87 insertions(+), 4 deletions(-)
>
> diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
> index 429879d..00d21a1 100644
> --- a/docs/manpages/virsh.rst
> +++ b/docs/manpages/virsh.rst
> @@ -1717,13 +1717,16 @@ domdirtyrate-calc
> ::
>
> domdirtyrate-calc <domain> [--seconds <sec>]
> + --mode=[page-sampling | dirty-bitmap | dirty-ring]
>
> Calculate an active domain's memory dirty rate which may be expected by
> user in order to decide whether it's proper to be migrated out or not.
> The ``seconds`` parameter can be used to calculate dirty rate in a
> specific time which allows 60s at most now and would be default to 1s
> -if missing. The calculated dirty rate information is available by calling
> -'domstats --dirtyrate'.
> +if missing. These three *page-sampling, dirty-bitmap, dirty-ring* modes
> +are mutually exclusive and alternative when specify calculation mode,
> +*page-sampling* is the default mode if missing. The calculated dirty
> +rate information is available by calling 'domstats --dirtyrate'.
>
>
> domdisplay
> diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
> index 8be2c21..7be4e02 100644
> --- a/src/libvirt-domain.c
> +++ b/src/libvirt-domain.c
> @@ -13337,7 +13337,7 @@ virDomainGetMessages(virDomainPtr domain,
> * virDomainStartDirtyRateCalc:
> * @domain: a domain object
> * @seconds: specified calculating time in seconds
> - * @flags: extra flags; not used yet, so callers should always pass 0
> + * @flags: bitwise-OR of supported virDomainDirtyRateCalcFlags
> *
> * Calculate the current domain's memory dirty rate in next @seconds