strange AMD x Intel Behaviour in 2.4.26
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 3 lines · Fabiano Ramos
The code is producing correct results (same as ptrace, I mean)
but is RUNNING FASTER on a 500Mhz AMD K6-2 than on a 2.6Ghz HT Pentium 4 !!!! The monitored code runs faster on P4 if not being
The Pentium 4 is slow for anything that involves changing of the ring or an exception. Well known problem, you can see it in other benchmarks too. Normally the penalty is not that drastic, probably it doesn't like single stepping very much.
However a cheaper way to do this would be to use performance counters and save/restore them on each context switch. There is normally a perfctr for "retired instructions on ring 3", which is what you want. Mikael P's perfctr patchkit can do that per process.
-Andi
Quoted 11 lines · Andi Kleen
Quoted 3 lines · Fabiano Ramos
The code is producing correct results (same as ptrace, I mean)
but is RUNNING FASTER on a 500Mhz AMD K6-2 than on a 2.6Ghz HT Pentium 4 !!!! The monitored code runs faster on P4 if not beingThe Pentium 4 is slow for anything that involves changing of the ring or an exception. Well known problem, you can see it in other benchmarks too. Normally the penalty is not that drastic, probably it doesn't like single stepping very much.
Quoted 5 lines
However a cheaper way to do this would be to use performance counters and save/restore them on each context switch. There is normally a perfctr for "retired instructions on ring 3", which is what you want. Mikael P's perfctr patchkit can do that per process.
OK, I'll check it. But I will still need to stick with the stop-at- every-instruction approach, since this counting is just the start of my project. I am developing a intepretation-like scheme, and need do do some action at every instruction. The counting was just the stopping
mechanism. I do not use ptrace, since I want to do it in kernel space.
Thanks, it was giving me nightmares :(
Quoted 2 lines
-Andi