Techniques described herein provide low-overhead adaptive instrumentation
runtime monitoring and analysis of software. A method of instrumenting a
program to provide instrumentation data creates instrumentation versions
comprising duplicate versions of original procedures in the program with
instrumentation code for capturing instrumentation data, and adaptively
decreases the sampling rate of the instrumented version of a procedure as
the frequency of execution of the procedure increases. Additionally, the
instrumentation methods can be used to build runtime tools that monitor
the correctness of a program with very little overhead.