Max Pole
Max Pole

Reputation: 319

Understanding QEMU clocks

I'm trying to understand QEMU clocks. There are several reference clocks available. The most important are:

It looks like QEMU_CLOCK_VIRTUAL is used by default.

I therefore wonder whether the QEMU_CLOCK_VIRTUAL is synchronized with the realtime clock? In other words, how virtual nanoseconds obtained from instruction counter are related to real nanoseconds so the user can perceive speed wise the emulated HW as the original one?

Can someone give me a hint? Thank you in advance!

Upvotes: 3

Views: 4133

Answers (1)

jcmvbkbc
jcmvbkbc

Reputation: 873

In other words, how virtual nanoseconds obtained from instruction counter are related to real nanoseconds

Virtual time is related to instruction counter only when QEMU runs with -icount option. In that case it does not match real time and its advancement speed depends on how fast host CPU runs guest instructions.

When -icount is not specified virtual time ticks synchronously with real time. If you try to measure guest instructions timing from inside the guest the result may be unrealistic.

Upvotes: 7

Related Questions