# US 8,752,007 B2 · Automatic generation of run-time instrumenter

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 8,752,007 B2
- Document ID: US8752007B2
- Status: Granted
- Kind: B2
- Application number: 12/056,063
- Filed: 2008-03-26
- Published: 2009-10-01
- Granted: 2014-06-10
- Earliest claimed: 2008-03-26
- Assignees: Avaya Inc.
- Applicants: Juan Jenny Li; David Mandel Weiss
- Inventors: Juan Jenny Li; David Mandel Weiss
- Web page: https://patentgrep.com/patent/US8752007B2

## CPC

- G06F 11/3644: {by instrumenting at runtime}
- G06F 11/3624: {by performing operations on the source code, e.g. via a compiler}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method and apparatus for automatically generating a run-time instrumenter are disclosed. In accordance with the illustrative embodiment, an off-line analyzer first determines instrumentation locations for a program under test in accordance with a method called the Super Nested Block Method. After the instrumentation locations have been determined, source code for a run-time instrumenter is automatically generated based on the source code for the program under test and the instrumentation locations. The source code for the program under test and the run-time instrumenter are then compiled into executables, and a testing tool then executes the program under test and the run-time instrumenter in parallel.

## Claims

### Claim 1

A system comprising:
a processor; and
a computer-readable storage device storing instructions which, when executed by the processor, cause the processor to perform operations comprising:
identifying a block in program source code, wherein:
(i) for any two consecutive lines of code within the block, when a first line of the two consecutive lines executes at a first time, the second line of the two consecutive lines executes at a second time later than the first time; and
(ii) for a pair of consecutive lines of code, line X and line Y, within the block, another line of code is executed between the line X and the line Y;
determining, based on (a) an analysis of the block and a control-flow graph of the block which indicates execution of a first node in the block implies execution of a first line of a second node in the block, and (b) a branch statement located within the block, an instrumentation location in the program source code;
generating run-time instrumenter source code based on the program source code and the instrumentation location;
compiling the program source code to yield a program;
compiling the run-time instrumenter source code to yield a run-time instrumenter executable; and
executing the program and the run-time instrumenter executable on a single device in parallel.

### Claim 2 (depends on 1)

The system of claim 1, wherein the program is for a real-time system.

### Claim 3 (depends on 1)

The system of claim 1, wherein the computer-readable storage device stores additional instructions which, when executed by the processor, cause the processor to perform the operations further comprising receiving an input that specifies a location in the program source code to yield another instrumentation location.

### Claim 4 (depends on 3)

The system of claim 3, wherein the computer-readable storage device stores additional instructions which, when executed by the processor, cause the processor to perform the operations further comprising inserting a probe at a specific location in the program during an execution of the program.

### Claim 5 (depends on 4)

The system of claim 4, wherein the computer-readable storage device stores additional instructions which, when executed by the processor, cause the processor to perform the operations further comprising removing the probe after the probe has been executed once.

### Claim 6

A method comprising:
identifying a block in program source code, wherein:
(i) for any two consecutive lines of code within the block, when a first line of the two consecutive lines executes at a first time, the second line of the two consecutive lines executes at a second time later than the first time; and
(ii) for a pair of consecutive lines of code, line X and line Y, within the block, another line of code is executed between the line X and the line Y;
determining, based on (a) an analysis of the block and a control-flow graph of the block which indicates execution of a first node in the block implies execution of a first line of a second node in the block, and (b) a branch statement located within the block, an instrumentation location in the program source code;
generating, via a processor, run-time instrumenter source code based on the program source code and the instrumentation location;
compiling the program source code to yield a program;
compiling the run-time instrumenter source code to yield a run-time instrumenter executable; and
executing the program and the run-time instrumenter executable on a single device in parallel.

### Claim 7 (depends on 6)

The method of claim 6, wherein the program is for a real-time system.

### Claim 8 (depends on 6)

The method of claim 6, further comprising receiving an input that specifies a location in the program source code to yield another instrumentation location.

### Claim 9 (depends on 8)

The method of claim 8, further comprising inserting a probe at a specific location in the program during the execution of the program.

### Claim 10 (depends on 9)

The method of claim 9, further comprising removing the probe after the probe has been executed once.

### Claim 11

A non-transitory computer-readable storage device storing instructions which, when executed by a processor, cause the processor to perform operations comprising:
identifying a block in program source code, wherein:
(i) for any two consecutive lines of code within the block, when a first line of the two consecutive lines executes at a first time, the second line of the two consecutive lines executes at a second time later than the first time; and
(ii) the block is not a basic block;
determining, based on (a) an analysis of the block and a control-flow graph of the block which indicates execution of a first node in the block implies execution of a first line of a second node in the block, and (b) a branch statement located within the block, an instrumentation location in the program source code;
generating run-time instrumenter source code based on the program source code and the instrumentation location;
compiling the program source code to yield a program;
compiling the run-time instrumenter source code to yield a run-time instrumenter executable; and
executing the program and the run-time instrumenter executable on a single device in parallel.

### Claim 12 (depends on 1)

The system of claim 1, wherein the run-time instrumenter executable generates a report of code coverage of the program after the program is executed.

### Claim 13 (depends on 6)

The method of claim 6, wherein the run-time instrumenter executable generates a report of code coverage of the program after the program is executed.

### Claim 14 (depends on 11)

The non-transitory computer-readable storage device of claim 11, wherein the run-time instrumenter executable generates a report of code coverage of the program after the program is executed.

### Claim 15 (depends on 6)

The method of claim 6, wherein generating the run-time instrumenter source code is done without user input.
