Optimally Profiling and Tracing Programs


This paper presents algorithms for inserting monitoring code to profile and trace programs. These algorithms greatly reduce the cost of measuring programs. Profiling counts the number of times each basic block in a program executes and has a variety of applications. Instruction traces are the basis for trace-driven simulation and analysis, and are also used in trace-driven debugging. The profiling algorithm chooses a placement of counters that is optimized—and frequently optimal—with respect to the expected or measured execution frequency of each basic block and branch in the program. The tracing algorithm instruments a program to obtain a subsequence of the basic block trace—whose length is optimized with respect to the program's execution—from which the entire trace can be efficiently regenerated. Both algorithms have been implemented and produce a substantial improvement over previous approaches. The profiling algorithm reduces the number of counters by a factor of two and the number of counter increments by up to a factor of four. The tracing algorithm reduces the file size and overhead of an already highly optimized tracing system by 20-40%.

DOI: 10.1145/143165.143180

Extracted Key Phrases

18 Figures and Tables

Citations per Year

500 Citations

Semantic Scholar estimates that this publication has 500 citations based on the available data.

See our FAQ for additional information.

Cite this paper

@inproceedings{Ball1992OptimallyPA, title={Optimally Profiling and Tracing Programs}, author={Thomas Ball and James R. Larus}, booktitle={ACM Trans. Program. Lang. Syst.}, year={1992} }