## Optimally Profiling and Tracing (1992)

Venue: | In Proceedings of the Conference on Principles of Programming Languages |

Citations: | 12 - 0 self |

### BibTeX

@INPROCEEDINGS{Ball92optimallyprofiling,

author = {Thomas Ball and James R. Larus},

title = {Optimally Profiling and Tracing},

booktitle = {In Proceedings of the Conference on Principles of Programming Languages},

year = {1992},

pages = {59--70}

}

### Years of Citing Articles

### OpenURL

### Abstract

This paper describes algorithms for inserting monitoring code to profile and trace programs. These algorithms greatly reduce the cost of measuring programs with respect to the commonly used technique of placing code in each basic block. Program profiling counts the number of times each basic block in a program executes. Instruction tracing records the sequence of basic blocks traversed in a program execution. The algorithms optimize the placement of counting/tracing code with respect to the expected or measured frequency of each block or edge in a programâ€™s control-flow graph. We have implemented the algorithms in a profiling/tracing tool, and they substantially reduce the overhead of profiling and tracing. We also define and study the hierarchy of profiling problems. These problems have two dimensions: what is profiled (i.e., vertices (basic blocks) or edges in a control-flow graph) and where the instrumentation code is placed (in blocks or along edges). We compare the optimal solutions to the profiling problems and describe a new profiling problem: basic-block profiling with edge counters. This problem is important because an optimal solution to any other profiling problem (for a given control-flow graph) is never better than an optimal solution to this problem. Unfortunately, finding an optimal placement of edge counters for vertex profiling appears to be a