qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-arm] [PATCH v2] Replaced get_tick_per_sec() by NANOSECONDS_PER


From: Paolo Bonzini
Subject: Re: [Qemu-arm] [PATCH v2] Replaced get_tick_per_sec() by NANOSECONDS_PER_SECOND
Date: Mon, 21 Mar 2016 17:24:02 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0


On 21/03/2016 17:02, address@hidden wrote:
> 
> Hi,
> This patch replaces get_ticks_per_sec() calls to NANOSECONDS_PER_SECOND. 
> Also, as there are no callers, get_ticks_per_sec() has been removed. 
> Replacement imporves readability and understandability of code.
> 
> Example given by Paolo Bonzini,
> 
> timer_mod(fdctrl->result_timer, 
>         qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + (get_ticks_per_sec() / 50));
> 
> NANOSECONDS_PER_SECOND makes it obvious that the timer will expire in 1/50th 
> of a second.

Looks good.  I've edited the commit message as follows:

--------
This patch replaces get_ticks_per_sec() calls with the macro
NANOSECONDS_PER_SECOND. Also, as there are no callers, get_ticks_per_sec()
is then removed.  This replacement improves the readability and
understandability of code.

For example,

    timer_mod(fdctrl->result_timer,
              qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + (get_ticks_per_sec() / 
50));

NANOSECONDS_PER_SECOND makes it obvious that qemu_clock_get_ns
matches the unit of the expression on the right side of the plus.
--------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]