Patent ID: 7478371

Claim:
A method for obtaining traces of a program, comprising: (a) obtaining an original set of instructions which define the program, wherein the original set of instructions does not include an instrumentation instruction; (b) obtaining an instrumented version of the original set of instructions, wherein the instrumented version of the original set of instructions includes each instruction in the original set of instructions and a number of instrumentation instructions defined to generate traces, wherein the number of instrumentation instructions are dispersed in a substantially uniform manner throughout the instrumented version of the original set of instructions; (c) executing the original set of instructions; (d) switching execution from the original set of instructions to the instrumented version of the original set of instructions upon encountering a first trigger condition, wherein the first trigger condition is an elapsed time of execution of the original set of instructions, wherein encountering the first trigger condition causes the switching of execution from the original set of instructions to the instrumented version of the original set of instructions to occur at a next location of known state in the original set of instructions; (e) executing the instrumented version of the original set of instructions so as to generate traces through execution of one or more of the number of instrumentation instructions; (f) switching execution from the instrumented version of the original set of instructions back to the original set of instructions upon encountering a second trigger condition, wherein the second trigger condition is an elapsed time of execution of the instrumented version of the original set of instructions, wherein encountering the second trigger condition causes the switching of execution from the instrumented version of the original set of instructions back to the original set of instructions to occur at a next location of known state in the instrumented version of the original set of instructions; and (g) repeating operations (c) through (f), wherein each of the first trigger condition and the second trigger condition is a respective temporal period defined independently from an instruction present in either the original set of instructions or the instrumented version of the original set of instructions.