qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>
Cc: Kevin Wolf <kwolf@redhat.com>, Marek Vasut <marex@denx.de>,
	"open list:Block layer core" <qemu-block@nongnu.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Laurent Vivier <lvivier@redhat.com>,
	Michael Roth <michael.roth@amd.com>,
	Chris Wulff <crwulff@gmail.com>,
	David Hildenbrand <david@redhat.com>,
	QEMU <qemu-devel@nongnu.org>, Laurent Vivier <laurent@vivier.eu>,
	Konstantin Kostiuk <kkostiuk@redhat.com>,
	Hanna Reitz <hreitz@redhat.com>,
	"open list:sPAPR pseries" <qemu-ppc@nongnu.org>,
	Stefan Weil <sw@weilnetz.de>, Paolo Bonzini <pbonzini@redhat.com>,
	Markus Armbruster <armbru@redhat.com>
Subject: Re: [PATCH v3 2/5] qtest: replace gettimeofday with GTimer
Date: Mon, 7 Mar 2022 10:59:55 +0100	[thread overview]
Message-ID: <6c402144-3ac8-fb62-ac9d-6e5656b51c9c@redhat.com> (raw)
In-Reply-To: <CAJ+F1CJgpC5JQ=Duw7vk8oF+fK9M0=ecqv+HVVaZS67FGY8C=A@mail.gmail.com>

On 07/03/2022 09.05, Marc-André Lureau wrote:
> Hi
> 
> On Mon, Mar 7, 2022 at 11:46 AM Thomas Huth <thuth@redhat.com 
> <mailto:thuth@redhat.com>> wrote:
> 
>     On 07/03/2022 08.03, marcandre.lureau@redhat.com
>     <mailto:marcandre.lureau@redhat.com> wrote:
>      > From: Marc-André Lureau <marcandre.lureau@redhat.com
>     <mailto:marcandre.lureau@redhat.com>>
>      >
>      > glib provides a convenience helper to measure elapsed time. It isn't
>      > subject to wall-clock time changes.
>      >
>      > Note that this changes the initial OPENED time, which used to print the
>      > current time.
>     [...]
>      > @@ -846,21 +828,20 @@ static void qtest_event(void *opaque,
>     QEMUChrEvent event)
>      >           for (i = 0; i < ARRAY_SIZE(irq_levels); i++) {
>      >               irq_levels[i] = 0;
>      >           }
>      > -        qemu_gettimeofday(&start_time);
>      > +
>      > +        g_clear_pointer(&timer, g_timer_destroy);
>      > +        timer = g_timer_new();
>      >           qtest_opened = true;
>      >           if (qtest_log_fp) {
>      > -            fprintf(qtest_log_fp, "[I " FMT_timeval "] OPENED\n",
>      > -                    (long) start_time.tv_sec, (long)
>     start_time.tv_usec);
>      > +            fprintf(qtest_log_fp, "[I " FMT_timeval "] OPENED\n",
>     g_timer_elapsed(timer, NULL));
>      >           }
>      >           break;
> 
>     The new timestamp here is quite unuseful now, of course ... could you
>     replace it with g_get_current_time()  instead?
> 
> 
> Eventually, but I wonder why this (and only this) particular timestamp 
> should be the current time.

I assume it was meant as a possibility to sync the times in this log with 
other things that are going on on the host system in parallel. If you only 
have the relative time stamps in the log here, you cannot compare the events 
to other logs anymore.
(having said that, I wonder why it doesn't simply always use the current 
wall time and uses the relative time instead, but maybe there is also a 
reason for that...)

  Thomas



  reply	other threads:[~2022-03-07 10:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-07  7:03 [PATCH v3 0/5] Remove qemu_gettimeofday() marcandre.lureau
2022-03-07  7:03 ` [PATCH v3 1/5] m68k/nios2-semi: fix gettimeofday() result check marcandre.lureau
2022-03-07  7:03 ` [PATCH v3 2/5] qtest: replace gettimeofday with GTimer marcandre.lureau
2022-03-07  7:45   ` Thomas Huth
2022-03-07  8:05     ` Marc-André Lureau
2022-03-07  9:59       ` Thomas Huth [this message]
2022-03-07  7:03 ` [PATCH v3 3/5] qga: replace qemu_gettimeofday() with g_get_real_time() marcandre.lureau
2022-03-07  7:50   ` Thomas Huth
2022-03-07  7:04 ` [PATCH v3 4/5] Replace " marcandre.lureau
2022-03-07  7:04 ` [PATCH v3 5/5] oslib: drop qemu_gettimeofday() marcandre.lureau

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=6c402144-3ac8-fb62-ac9d-6e5656b51c9c@redhat.com \
    --to=thuth@redhat.com \
    --cc=armbru@redhat.com \
    --cc=crwulff@gmail.com \
    --cc=david@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=kkostiuk@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=laurent@vivier.eu \
    --cc=lvivier@redhat.com \
    --cc=marcandre.lureau@gmail.com \
    --cc=marex@denx.de \
    --cc=michael.roth@amd.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=sw@weilnetz.de \
    /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).