qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Aleksandar Rakic <aleksandar.rakic@htecgroup.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: Djordje Todorovic <Djordje.Todorovic@htecgroup.com>,
	"cfu@mips.com" <cfu@mips.com>,
	"arikalo@gmail.com" <arikalo@gmail.com>,
	"peter.maydell@linaro.org" <peter.maydell@linaro.org>
Subject: Re: [PATCH v2 6/8] Revert use of clock_gettime for benchmarking
Date: Sun, 20 Oct 2024 16:04:11 +0200	[thread overview]
Message-ID: <e98fb78a-ff2a-4c32-a7b0-95b73b54d94d@redhat.com> (raw)
In-Reply-To: <AM9PR09MB485113D76C5AE02516C08E8E84402@AM9PR09MB4851.eurprd09.prod.outlook.com>

On 10/18/24 15:20, Aleksandar Rakic wrote:
> This patch reverts the commit (with SHA
> 50290c002c045280f8defad911901e16bfb52884 from
> https://github.com/MIPS/gnutools-qemu) that breaks for mingw builds,
> where clock_gettime and CLOCK_MONOTONIC are not available.
> 
> Cherry-picked d57c735e1af1ca719dbd0c3a904ad70c9c31cbb7
> from https://github.com/MIPS/gnutools-qemu
> 
> Signed-off-by: Faraz Shahbazker <fshahbazker@wavecomp.com>
> Signed-off-by: Aleksandar Rakic <aleksandar.rakic@htecgroup.com>

Can you change it to use qemu_clock_get_ns(QEMU_CLOCK_REALTIME) instead? 
  It's the same as clock_gettime() on POSIX systems and works on Windows 
as well.

Plus, because the result is just use uint64_t, tsub and tdiv become 
simple subtraction and (double)a / b respectively; and timestr is also 
just as simple with:

-    double frac_sec = tv->tv_nsec / 1e9;
+    uint64_t sec = nsec / NANOSECONDS_PER_SECOND;
+    double frac_sec = (nsec % NANOSECONDS_PER_SECOND) / 1e9;

Paolo



      parent reply	other threads:[~2024-10-20 14:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-18 13:20 [PATCH v2 6/8] Revert use of clock_gettime for benchmarking Aleksandar Rakic
2024-10-19 19:35 ` Philippe Mathieu-Daudé
2024-10-21 11:42   ` Kevin Wolf
2024-10-21 11:48     ` Daniel P. Berrangé
2024-10-20 14:04 ` Paolo Bonzini [this message]

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=e98fb78a-ff2a-4c32-a7b0-95b73b54d94d@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=Djordje.Todorovic@htecgroup.com \
    --cc=aleksandar.rakic@htecgroup.com \
    --cc=arikalo@gmail.com \
    --cc=cfu@mips.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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).