Stefano Bonifazi writes: > On 01/24/2011 03:32 PM, Peter Maydell wrote: >> >> Being a JIT doesn't prohibit counting target instructions executed. >> It just means that counting them generally requires generating >> code to do the counting at runtime, so it's a more complicated >> change to make than it would be in a non-JIT emulator. >> > What do you mean? Should I change the code of qemu-user for counting the > instructions, or should I add code into the target binaries?
If I recall this correctly, target-i386 has a generic function (whose name I don't remember) called whenever the rdtsc instruction is executed. This function rebuilds the counter that contains the number of executed instructions (more or less, this number can be tuned from a variety of sources). Lluis -- "And it's much the same thing with knowledge, for whenever you learn something new, the whole world becomes that much richer." -- The Princess of Pure Reason, as told by Norton Juster in The Phantom Tollbooth