|
| From: | Paolo Bonzini |
| Subject: | Re: [Qemu-devel] [RFC PATCH V4 6/6] monitor: Add drift info to 'info jit' |
| Date: | Wed, 16 Jul 2014 15:18:33 +0200 |
| User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
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
| [Prev in Thread] | Current Thread | [Next in Thread] |