From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Andrei Gudkov <gudkov.andrei@huawei.com>, qemu-devel@nongnu.org
Cc: yong.huang@smartx.com, quintela@redhat.com, peterx@redhat.com,
leobras@redhat.com, eblake@redhat.com, armbru@redhat.com
Subject: Re: [PATCH] migration/dirtyrate: use QEMU_CLOCK_HOST to report start-time
Date: Tue, 5 Sep 2023 11:39:28 +0200 [thread overview]
Message-ID: <62489e2b-5d03-1650-6337-a4159e88e439@linaro.org> (raw)
In-Reply-To: <399861531e3b24a1ecea2ba453fb2c3d129fb03a.1693905328.git.gudkov.andrei@huawei.com>
Hi Andrei,
On 5/9/23 11:18, Andrei Gudkov via wrote:
> Currently query-dirty-rate uses QEMU_CLOCK_REALTIME as
> the source for start-time field. This translates to
> clock_gettime(CLOCK_MONOTONIC), i.e. number of seconds
> since host boot. This is not very useful. The only
> reasonable use case of start-time I can imagine is to
> check whether previously completed measurements are
> too old or not. But this makes sense only if start-time
> is reported as host wall-clock time.
>
> This patch replaces source of start-time from
> QEMU_CLOCK_REALTIME to QEMU_CLOCK_HOST.
>
> Signed-off-by: Andrei Gudkov <gudkov.andrei@huawei.com>
> ---
> qapi/migration.json | 4 ++--
> migration/dirtyrate.c | 15 ++++++---------
> 2 files changed, 8 insertions(+), 11 deletions(-)
> diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c
> index bccb3515e3..0510d68765 100644
> --- a/migration/dirtyrate.c
> +++ b/migration/dirtyrate.c
> @@ -259,11 +259,10 @@ static struct DirtyRateInfo *query_dirty_rate_info(void)
> return info;
> }
>
> -static void init_dirtyrate_stat(int64_t start_time,
> - struct DirtyRateConfig config)
> +static void init_dirtyrate_stat(struct DirtyRateConfig config)
> {
> DirtyStat.dirty_rate = -1;
> - DirtyStat.start_time = start_time;
> + DirtyStat.start_time = qemu_clock_get_ms(QEMU_CLOCK_HOST) / 1000;
> DirtyStat.calc_time = config.sample_period_seconds;
> DirtyStat.sample_pages = config.sample_pages_per_gigabytes;
>
> @@ -600,7 +599,7 @@ static void calculate_dirtyrate_dirty_bitmap(struct DirtyRateConfig config)
> record_dirtypages_bitmap(&dirty_pages, true);
>
> start_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);
> - DirtyStat.start_time = start_time / 1000;
> + DirtyStat.start_time = qemu_clock_get_ms(QEMU_CLOCK_HOST) / 1000;
You can directly use qemu_clock_get_us().
next prev parent reply other threads:[~2023-09-05 9:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-05 9:18 [PATCH] migration/dirtyrate: use QEMU_CLOCK_HOST to report start-time Andrei Gudkov via
2023-09-05 9:39 ` Philippe Mathieu-Daudé [this message]
2023-09-19 9:14 ` Markus Armbruster
2023-09-19 9:44 ` gudkov.andrei--- via
2023-09-25 0:53 ` Yong Huang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=62489e2b-5d03-1650-6337-a4159e88e439@linaro.org \
--to=philmd@linaro.org \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=gudkov.andrei@huawei.com \
--cc=leobras@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=yong.huang@smartx.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).