Re: [PATCH v2] Replaced get_tick_per_sec() by NANOSECONDS_PER_SECOND

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

 




On 21/03/2016 17:02, rutu.shah.26@xxxxxxxxx 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.
--------
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux