Paul Brook <paul@xxxxxxxxxxxxxxxx> schrieb:
>> So my question is how can I get accurate guest instruction count number?
> -icount maintains an accurate count of the number of instructions executed.
> However for performance reasons the counter value is not valid at all times.
> Also note that you can not assume that a whole TB is executed (because of MMU
> faults, or IO interrupts).
> Even with -icount, qemu is only deterministic internally. Its behavior can
> still be influenced by external events. In usermode this could be any
> syscall. In system mode this could be mouse/keyboard input, modified disk
> images or network traffic (possibly other things I've missed).
I am using system mode exclusively.
> If you need counts of specific instructions then you probably need to add
> explicit counters to the implementation of those instructions.
I disabled all timers in Qemu and run a guest program, which includes an
assembly-coded loop. At the start and end of the loop I have a magic
instruction, upon which Qemu prints the current output of cpu_get_clock. I run
qemu with the flag -icount 0.
Still, the delta of those two values does not in any kind resemble the amount
of instructions, and worse it is not constant with subsequent runs.
Can you give any suggestions on how to get a precise absolut guest instruction