[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH v9 12/23] timer: replace time() with QEMU_CL
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [RFC PATCH v9 12/23] timer: replace time() with QEMU_CLOCK_HOST |
Date: |
Wed, 18 Feb 2015 14:04:12 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
On 18/02/2015 12:56, Pavel Dovgalyuk wrote:
> This patch replaces time() function calls with calls to
> qemu_clock_get_ns(QEMU_CLOCK_HOST). It makes such requests deterministic
> in record/replay mode of icount.
>
> Signed-off-by: Pavel Dovgalyuk <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
> ---
> vl.c | 12 ++++++++----
> 1 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/vl.c b/vl.c
> index 8c8f142..00161f4 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -710,13 +710,17 @@ void vm_start(void)
> /***********************************************************/
> /* real time host monotonic timer */
>
> +static time_t qemu_time(void)
> +{
> + return qemu_clock_get_ms(QEMU_CLOCK_HOST) / 1000;
> +}
> +
> /***********************************************************/
> /* host time/date access */
> void qemu_get_timedate(struct tm *tm, int offset)
> {
> - time_t ti;
> + time_t ti = qemu_time();
>
> - time(&ti);
> ti += offset;
> if (rtc_date_offset == -1) {
> if (rtc_utc)
> @@ -744,7 +748,7 @@ int qemu_timedate_diff(struct tm *tm)
> else
> seconds = mktimegm(tm) + rtc_date_offset;
>
> - return seconds - time(NULL);
> + return seconds - qemu_time();
> }
>
> static void configure_rtc_date_offset(const char *startdate, int legacy)
> @@ -782,7 +786,7 @@ static void configure_rtc_date_offset(const char
> *startdate, int legacy)
> "'2006-06-17T16:01:21' or '2006-06-17'\n");
> exit(1);
> }
> - rtc_date_offset = time(NULL) - rtc_start_date;
> + rtc_date_offset = qemu_time() - rtc_start_date;
> }
> }
>
>
>
>
- [Qemu-devel] [RFC PATCH v9 08/23] cpu: replay instructions sequence, (continued)
- [Qemu-devel] [RFC PATCH v9 08/23] cpu: replay instructions sequence, Pavel Dovgalyuk, 2015/02/18
- [Qemu-devel] [RFC PATCH v9 09/23] replay: interrupts and exceptions, Pavel Dovgalyuk, 2015/02/18
- [Qemu-devel] [RFC PATCH v9 10/23] replay: asynchronous events infrastructure, Pavel Dovgalyuk, 2015/02/18
- [Qemu-devel] [RFC PATCH v9 11/23] replay: recording and replaying clock ticks, Pavel Dovgalyuk, 2015/02/18
- [Qemu-devel] [RFC PATCH v9 12/23] timer: replace time() with QEMU_CLOCK_HOST, Pavel Dovgalyuk, 2015/02/18
- Re: [Qemu-devel] [RFC PATCH v9 12/23] timer: replace time() with QEMU_CLOCK_HOST,
Paolo Bonzini <=
- [Qemu-devel] [RFC PATCH v9 13/23] replay: shutdown event, Pavel Dovgalyuk, 2015/02/18
- [Qemu-devel] [RFC PATCH v9 14/23] replay: checkpoints, Pavel Dovgalyuk, 2015/02/18
- [Qemu-devel] [RFC PATCH v9 15/23] aio: replace stack of bottom halves with queue, Pavel Dovgalyuk, 2015/02/18
- [Qemu-devel] [RFC PATCH v9 16/23] replay: bottom halves, Pavel Dovgalyuk, 2015/02/18
- [Qemu-devel] [RFC PATCH v9 17/23] replay: replay aio requests, Pavel Dovgalyuk, 2015/02/18
- [Qemu-devel] [RFC PATCH v9 18/23] replay: thread pool, Pavel Dovgalyuk, 2015/02/18
- [Qemu-devel] [RFC PATCH v9 19/23] typedef: add typedef for QemuOpts, Pavel Dovgalyuk, 2015/02/18