I want to measure how my Pintool worsens the execution time of an executable in the case where it simply does "empty instrumentation".
Basicly in my Pintool I got a callback which is called every time an Image is loaded which, in turn, inserts analysis functions for specific routines.
So I was thinking of measuring the "empty instrumentation" overhead using two modes of operation:
Is this approach viable? Are there better solutions I am unaware of?
Pin performs a number of optimizations to generate very efficient instrumented code. In particular, empty analysis routines will definitely get inlined into the application routines. Empty functions in C/C++ will most likely get compiled to a single instruction (on x86, it's some form of ret
). Pin may be able to recognize that and completely remove that instruction, leaving you with zero instrumentation. You can determine whether Pin removes ret
by comparing the performance without any instrumentation and that of with empty analysis routines. If the difference is zero, there is a good chance that Pin eliminated the instruction. Although this is not documented as far as I know.