United States Patent m
 METHOD AND SYSTEM FOR SELECTING INSTRUMENTATION POINTS IN A COMPUTER PROGRAM
 Inventor: Keith Randel Vogel, Duvall. Wash.
 Assignee: Microsoft Corporation, Redmond.
 Appl. No.: 268,444
 Filed: Jun. 30,1994
 IntCl.6 G06F9/44
 U.S. CI 395/704; 395/183.11
 Field of Search 371/16. 19; 395/700,
395/704. 183.11. 183.14
 References Cited
U.S. PATENT DOCUMENTS
3,427,443 2/1969 Apple et al 371/19 X
3,551,659 12/1970 Fotsythe 371/19 X
4,819,233 4/1989 DeLuciaetal 371/19
Robert Endre Tarjan, "Minimum Spanning Trees," Data Structures and Network Algorithms, Chapter 6, 1983. pp. 71-83.
James R. Larus et al., "Rewriting Executable Files to Measure Program Behavior," University of Wisconsin Computer Sciences Technical Report 108S, 1992. pp. 1-17. Thomas Ball et al.. "Optimally Profiling and Tracing Programs," University of Wisconsin Computer Sciences Technical Report 1031, 1991. pp. 1-27. Vivek Sarkar, "Determining Average Program Execution Times and their Variance," Proceedings of SIGPLAN '89 Conference on Programming Language Design and Implementation, SIGPLAN Notices, vol. 24. No. 7. Jul. 1989. pp. 298-312.
Karl Pettis et al. "Profile Guided Code Positioning," Proceedings of the ACM SIGPLAN '90 Conference on Programming Language Design and Implementation, Jun. 20-22. 1990, pp. 16-27.
US005790858A [ii] Patent Number: 5,790,858  Date of Patent: Aug. 4, 1998
"Using Profile Information to Assist Classic Code Optmizations". Chang et al. Soft. Practice & Experience, vol. 21(12). 1301-1321. Dec. 1991.
"Improving UNIX Kernel Performance Using Profile Based C^tirnization,\ Speer et al.. 1994 Winter USENIX. Jan. 17-21. 1994. pp. 181-188.
Larus et al., "Rewriting Executable Files to Measure program Behavior", Univ. of Wisconsin Comp. Sci. Tech. Report. 1991, pp. 1-27.
"Rewriting Executable Files to Measure Program Behavior". Larus et al., Univ. of Wisconsin Comp. Sci. Tech. Report 1083. 1992. pp. 1-17.
"Optimally Profiling and Tracing Programs". Ball et al..
Tech. Report #1031, Univ. of Wisconsin. Sep. 1991.
"Data Structures and Algorithms", Aho et al.. Addison-Wes-
ley. 1987. pp. 215-218 (Section 6.5).
Primary Examiner—Emanuel T. Voeltz
Assistant Examiner—Kakali Chaki
Attorney, Agent, or Firm—Seed and Berry LLP
The present invention provides a method in a computer system for selecting instrumentation points in a computer program. Instrumentation points are locations within the computer program at which instrumentation code is inserted. The method includes identifying code portions such as basic blocks in the computer program code, creating a control flow graph out of the code portions, generating a spanning tree for the control flow graph, and then selecting those edges of the control flow graph which are not a part of the spanning tree as instrumentation points. After instrumentation points are selected, instrumentation code may be added at those locations. When the computer program is executed, the added instrumentation code records execution information such as how many times an instrumentation point is accessed during execution of the computer program. Using the recorded execution information and direction specified in the control flow graph, execution information for the non-instrumented blocks may then be calculated.
9 Claims, 11 Drawing Sheets
SELECT EDGES IN CONTROL
FLOW GRAPH THAT ARE NOT
IN SPANNING TREE AS
ADD INSTRUMENTATION CODE TO SLOCKS THAT CORRESPOND TO INSTR UMENTATION POINTS
TO RECORD EXECUTION INFO FOR INSTftuMENTEC BLOCKS!
USE RECORDEO EXECUTION INFO AND DIRECTION IN CONTROL FLOW GRAPH TO CALCULATE
EXECUTION (MFC FDR