exploring the use of ptrace vs the x86 trapflag to step through every instruction of a program.
there are three small programs executing a certain number of instructions:
count-ptrace.cuses ptrace to step through every instruction, executing
count-trapflag.cuses the x86 trap flag and signal handlers to execute
~1e9instructions without any instrumentation
These are the execution times on my netbook (32-bit Intel Atom N450, 1.66GHz):
This implies the following slow-downs of the different instrumentation schemes:
101,172xslower with ptrace
6,244xslower with trapflag and x86
This implies using the trapflag+signal handlers is about
16x faster than using ptrace.