From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59380) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ai2cy-0005oq-8T for qemu-devel@nongnu.org; Mon, 21 Mar 2016 12:24:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ai2cu-0000Kk-4J for qemu-devel@nongnu.org; Mon, 21 Mar 2016 12:24:24 -0400 References: <[PATCH v2] Replaced get_tick_per_sec() by NANOSECONDS_PER_SECOND> <1458576150-3384-1-git-send-email-rutu.shah.26@gmail.com> From: Paolo Bonzini Message-ID: <56F02022.40108@redhat.com> Date: Mon, 21 Mar 2016 17:24:02 +0100 MIME-Version: 1.0 In-Reply-To: <1458576150-3384-1-git-send-email-rutu.shah.26@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] Replaced get_tick_per_sec() by NANOSECONDS_PER_SECOND List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 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. --------