[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] replaced get_ticks_per_sec() with constant
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH] replaced get_ticks_per_sec() with constant |
Date: |
Mon, 30 Mar 2015 14:01:09 +0100 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
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
pgpONYAouOuxp.pgp
Description: PGP signature