qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org, Emil Condrea <emilcondrea@gmail.com>
Subject: Re: [Qemu-devel] [PATCH] replaced get_ticks_per_sec() with constant
Date: Mon, 30 Mar 2015 14:01:09 +0100	[thread overview]
Message-ID: <20150330130109.GI25181@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1427559731-20180-1-git-send-email-emilcondrea@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1624 bytes --]

On Sat, Mar 28, 2015 at 06:22:11PM +0200, Emil Condrea wrote:
> diff --git a/target-arm/helper.c b/target-arm/helper.c
> index 10886c5..504530a 100644
> --- a/target-arm/helper.c
> +++ b/target-arm/helper.c
> @@ -649,7 +649,7 @@ void pmccntr_sync(CPUARMState *env)
>      uint64_t temp_ticks;
>  
>      temp_ticks = muldiv64(qemu_clock_get_us(QEMU_CLOCK_VIRTUAL),
> -                          get_ticks_per_sec(), 1000000);
> +                          NSEC_PER_SEC, 1000000);
>  
>      if (env->cp15.c9_pmcr & PMCRD) {
>          /* Increment once every 64 processor clock cycles */
> @@ -688,7 +688,7 @@ static uint64_t pmccntr_read(CPUARMState *env, const ARMCPRegInfo *ri)
>      }
>  
>      total_ticks = muldiv64(qemu_clock_get_us(QEMU_CLOCK_VIRTUAL),
> -                           get_ticks_per_sec(), 1000000);
> +                           NSEC_PER_SEC, 1000000);
>  
>      if (env->cp15.c9_pmcr & PMCRD) {
>          /* Increment once every 64 processor clock cycles */
> @@ -709,7 +709,7 @@ static void pmccntr_write(CPUARMState *env, const ARMCPRegInfo *ri,
>      }
>  
>      total_ticks = muldiv64(qemu_clock_get_us(QEMU_CLOCK_VIRTUAL),
> -                           get_ticks_per_sec(), 1000000);
> +                           NSEC_PER_SEC, 1000000);

Peter: I wonder why the muldiv64() expression is necessary.  Is it
intentionally returning the microsecond clock converted to nanoseconds?

Perhaps the expression should be replaced with just
qemu_get_clock_ns(QEMU_CLOCK_VIRTUAL)?

Or if microsecond precision is required, use qemu_get_clock_us() * 1000.

Stefan

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2015-03-30 13:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-28 16:22 [Qemu-devel] [PATCH] replaced get_ticks_per_sec() with constant Emil Condrea
2015-03-30 13:01 ` Stefan Hajnoczi [this message]
2015-03-30 21:52   ` Peter Maydell
2015-03-30 23:46     ` Peter Crosthwaite
2015-03-31 14:19       ` Stefan Hajnoczi
2015-03-30 13:01 ` Stefan Hajnoczi
2015-03-31 17:16   ` Emil Condrea
2015-07-05  6:15     ` Emil Condrea
2015-07-06 15:11       ` Stefan Hajnoczi
2015-07-08 13:29         ` Emil Condrea
2015-07-09  9:05           ` Stefan Hajnoczi

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=20150330130109.GI25181@stefanha-thinkpad.redhat.com \
    --to=stefanha@redhat.com \
    --cc=emilcondrea@gmail.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).