From: Paolo Bonzini <pbonzini@redhat.com>
To: rutu.shah.26@gmail.com, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, kvm@vger.kernel.org, mst@redhat.com,
jasowang@redhat.com, mark.cave-ayland@ilande.co.uk,
lcapitulino@redhat.com, blauwirbel@gmail.com, kraxel@redhat.com,
qemu-block@nongnu.org, agraf@suse.de, borntraeger@de.ibm.com,
samuel.thibault@ens-lyon.org, alistair.francis@xilinx.com,
qemu-arm@nongnu.org, stefanha@redhat.com,
cornelia.huck@de.ibm.com, jsnow@redhat.com, rth@twiddle.net,
kwolf@redhat.com, crosthwaite.peter@gmail.com, armbru@redhat.com,
qemu-ppc@nongnu.org, imammedo@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2] Replaced get_tick_per_sec() by NANOSECONDS_PER_SECOND
Date: Mon, 21 Mar 2016 17:24:02 +0100 [thread overview]
Message-ID: <56F02022.40108@redhat.com> (raw)
In-Reply-To: <1458576150-3384-1-git-send-email-rutu.shah.26@gmail.com>
On 21/03/2016 17:02, rutu.shah.26@gmail.com 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.
--------
prev parent reply other threads:[~2016-03-21 16:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <[PATCH v2] Replaced get_tick_per_sec() by NANOSECONDS_PER_SECOND>
2016-03-20 18:31 ` [Qemu-devel] [PATCH v2] Replaced get_tick_per_sec() by NANOSECONDS_PER_SECOND rutu.shah.26
2016-03-20 18:31 ` rutu.shah.26
2016-03-21 8:17 ` Christian Borntraeger
2016-03-20 18:35 ` rutuja shah
2016-03-21 16:02 ` rutu.shah.26
2016-03-21 16:24 ` 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=56F02022.40108@redhat.com \
--to=pbonzini@redhat.com \
--cc=agraf@suse.de \
--cc=alistair.francis@xilinx.com \
--cc=armbru@redhat.com \
--cc=blauwirbel@gmail.com \
--cc=borntraeger@de.ibm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=crosthwaite.peter@gmail.com \
--cc=imammedo@redhat.com \
--cc=jasowang@redhat.com \
--cc=jsnow@redhat.com \
--cc=kraxel@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kwolf@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=rth@twiddle.net \
--cc=rutu.shah.26@gmail.com \
--cc=samuel.thibault@ens-lyon.org \
--cc=stefanha@redhat.com \
/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).