Method and apparatus for profiling indirect procedure calls in a computer program
First Claim
1. An apparatus comprising:
- at least one processor;
a memory coupled to the at least one processor;
a computer program residing in the memory comprising a plurality of procedures;
a profiling mechanism residing in the memory and executed by the at least one processor, the profiling mechanism determining which of the plurality of procedures are most frequently called at a plurality of indirect call sites in the computer program during execution of the computer program using a plurality of counters corresponding to each indirect call site.
1 Assignment
0 Petitions
Accused Products
Abstract
An apparatus and method provide more complete profile data by instrumenting indirect procedure calls in a computer program. Indirect procedure calls have a number of counters allocated in a table at each indirect call site. The counters are divided into counters in a low volatility area and counters in a high volatility area. The counters in the high volatility area have a pointer that identifies the next procedure to be replaced. As the instrumented code executes, a call to a procedure that is in the table increments the count of the counter in the table. A call to a procedure not in the table is placed in the high volatility area, displacing the procedure at the pointer, and moves the pointer to a new location. The displaced procedure is either promoted to the low volatility area, or is discarded. If promoted, the procedure that it displaces in the low volatility area is demoted to the high volatility area, displacing a procedure there at the pointer (and moving the pointer to a new location). This process continues until a displaced high volatility procedure is discarded.
105 Citations
27 Claims
-
1. An apparatus comprising:
-
at least one processor; a memory coupled to the at least one processor; a computer program residing in the memory comprising a plurality of procedures; a profiling mechanism residing in the memory and executed by the at least one processor, the profiling mechanism determining which of the plurality of procedures are most frequently called at a plurality of indirect call sites in the computer program during execution of the computer program using a plurality of counters corresponding to each indirect call site. - View Dependent Claims (2, 3, 4, 5, 6, 7)
-
-
8. An apparatus comprising:
-
at least one processor; a memory coupled to the at least one processor; an instrumented computer program residing in the memory, the instrumented computer program comprising a plurality of procedures, the instrumented computer program further comprising a plurality of counters corresponding to each of a plurality of indirect call sites, the plurality of counters determining which of the plurality of procedures are most frequently called at the plurality of indirect call sites during execution of the instrumented computer program. - View Dependent Claims (9, 10)
-
-
11. An apparatus comprising:
-
at least one processor; a memory coupled to the at least one processor; a computer program residing in the memory comprising a plurality of procedures; a plurality of counters corresponding to each indirect call site in the computer program, the plurality of counters including a plurality of high volatility counters and a plurality of low volatility counters, each of the plurality of counters identifying a called procedure and a count for the called procedure; a profiling mechanism residing in the memory and executed by the at least one processor, the profiling mechanism determining which of the plurality of procedures are most frequently called at a plurality of indirect call sites in the computer program, the profiling mechanism comprising; an indirect call site instrumentation code generator for providing the plurality of counters at each indirect call site; and a pointer pointing to one of the plurality of high volatility counters to form a first-in-first-out (FIFO) buffer in the plurality of high volatility counters.
-
-
12. A method of collecting profile data at indirect call sites in a computer program comprising the steps of:
-
executing a computer program comprising a plurality of procedures; determining which of the plurality of procedures are most frequently called at a plurality of indirect call sites during the execution of the computer program using a plurality of counters corresponding to each indirect call site.
-
-
13. A method for instrumenting a computer program, the computer program including a plurality of procedures, the method comprising the steps of:
-
allocating a plurality of counters to each of a plurality of indirect call sites in the computer program; and inserting instrumentation code into the computer program to interact with the plurality of counters according to predetermined criteria that results in the plurality of counters determining which of the plurality of procedures are most frequently called at the plurality of indirect call sites when the instrumented computer program is executed.
-
-
14. A method of collecting profile data at indirect call sites in a computer program, the method comprising the steps of:
-
(A) providing a plurality of high and low volatility counters at each indirect call site; (B) for each call to a procedure at a selected indirect call site during execution of the computer program, performing the steps of; (1) determining whether the called procedure is in the plurality of counters corresponding to the selected indirect call site; (2) if the called procedure is in the plurality of corresponding counters, incrementing the counter corresponding to the called procedure; (3) if the called procedure is not in the plurality of corresponding counters, performing the steps of; (a) displacing a high volatility procedure in one of the plurality of high volatility counters with the called procedure; (b) promoting the displaced high volatility procedure to one of the plurality of low volatility counters if the displaced high volatility procedure satisfies predetermined promotion criteria; (c) discarding the displaced high volatility procedure if it does not satisfy the predetermined promotion criteria; (d) demoting any procedure displaced by a promoted procedure to displace a high volatility procedure in one of the plurality of high volatility counters; (e) repeating steps (b) through (d) until the most recently displaced high volatility procedure is discarded. - View Dependent Claims (15)
-
-
16. A method of collecting profile data at indirect call sites in a computer program, the method comprising the steps of:
-
(A) providing a plurality of high and low volatility counters at each indirect call site, each of the plurality of counters identifying a called procedure and a count for the called procedure; (B) providing a pointer for the plurality of high volatility counters that points to one of the high volatility counters and advances to the next high volatility counter when the pointer is incremented, the pointer pointing to one of the plurality of high volatility counters to form a first-in-first-out (FIFO) buffer in the plurality of high volatility counters; (C) providing instrumentation code in the computer program at each indirect call site; (D) executing the computer program; (E) for each call to a procedure at a selected indirect call site during the execution of the computer program, performing the steps of; (1) determining whether the called procedure is in the plurality of counters corresponding to the selected indirect call site; (2) if the called procedure is in the plurality of corresponding counters, incrementing the count of the called procedure; (3) if the called procedure is not in the plurality of corresponding counters, performing the steps of; (a) displacing a high volatility procedure in the high volatility counter identified by the pointer; (b) incrementing the pointer; (c) promoting the displaced high volatility procedure to one of the plurality of low volatility counters if the displaced high volatility procedure satisfies predetermined promotion criteria; (d) discarding the displaced high volatility procedure if it does not satisfy the predetermined promotion criteria; (e) demoting any procedure displaced by a promoted procedure to displace a high volatility procedure the high volatility counter identified by the pointer; (f) repeating steps (b) through (e) until the most recently displaced high volatility procedure is discarded. - View Dependent Claims (17, 18)
-
-
19. A program product comprising:
-
(A) a profiling mechanism that determines which of a plurality of procedures in a computer program are most frequently called at a plurality of indirect call sites in the computer program using a plurality of counters corresponding to each indirect call site; and (B) computer-readable signal bearing media bearing the profiling mechanism. - View Dependent Claims (20, 21, 22, 23, 24, 25, 26)
-
-
27. A program product comprising:
-
(A) a profiling mechanism that determines which of a plurality of procedures are most frequently called at a plurality of indirect call sites in a computer program, the profiling mechanism comprising; (1) an indirect call site instrumentation code generator for providing a plurality of high and low volatility counters at each indirect call site; (2) a pointer pointing to one of the plurality of high volatility counters to form a first-in-first-out (FIFO) buffer in the plurality of high volatility counters; and (B) computer-readable signal bearing media bearing the profiling mechanism.
-
Specification