qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] migration/dirtyrate: use QEMU_CLOCK_HOST to report start-tim


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH] migration/dirtyrate: use QEMU_CLOCK_HOST to report start-time
Date: Tue, 5 Sep 2023 11:39:28 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.0

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().




reply via email to

[Prev in Thread] Current Thread [Next in Thread]