From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36699) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X7P77-0003Al-Lv for qemu-devel@nongnu.org; Wed, 16 Jul 2014 09:19:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X7P70-0005kz-6K for qemu-devel@nongnu.org; Wed, 16 Jul 2014 09:19:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33630) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X7P6z-0005kr-UE for qemu-devel@nongnu.org; Wed, 16 Jul 2014 09:19:10 -0400 Message-ID: <53C67BA9.50009@redhat.com> Date: Wed, 16 Jul 2014 15:18:33 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1405513086-31246-1-git-send-email-sebastian.tanase@openwide.fr> <1405513086-31246-7-git-send-email-sebastian.tanase@openwide.fr> In-Reply-To: <1405513086-31246-7-git-send-email-sebastian.tanase@openwide.fr> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH V4 6/6] monitor: Add drift info to 'info jit' List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sebastian Tanase , qemu-devel@nongnu.org Cc: kwolf@redhat.com, peter.maydell@linaro.org, aliguori@amazon.com, wenchaoqemu@gmail.com, quintela@redhat.com, mst@redhat.com, stefanha@redhat.com, armbru@redhat.com, lcapitulino@redhat.com, michael@walle.cc, camille.begue@openwide.fr, alex@alex.org.uk, crobinso@redhat.com, afaerber@suse.de, rth@twiddle.net Il 16/07/2014 14:18, Sebastian Tanase ha scritto: > - static int64_t clocks_offset; > - if (!icount_align_option) { > - return; > + static int64_t realtime_clock_value; Does this really need to be static? > + if (icount_align_option || !realtime_clock_value) { > + realtime_clock_value = qemu_clock_get_ns(QEMU_CLOCK_REALTIME); > } > - sc->realtime_clock = qemu_clock_get_ns(QEMU_CLOCK_REALTIME); > /* Compute offset between the 2 clocks. */ > if (!clocks_offset) { > - clocks_offset = sc->realtime_clock - > + clocks_offset = realtime_clock_value - > qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); > } Isn't clocks_offset roughly the same as -timers_state.cpu_clock_offset? If so, you could be some simplification in the code. Feel free to move the TimersState struct definition to include/sysemu/cpus.h and make timers_state public. > + cpu_fprintf(f, "Host - Guest clock %ld(ms)\n", > + (qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - clocks_offset - > + qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL))/SCALE_MS); I think this is (cpu_get_clock() - cpu_get_icount()) / SCALE_MS. Paolo