Patent Number: 
Section: description

The following description of embodiments of the present invention refers to the accompanying drawings. Where appropriate, the same reference numbers in different drawings refer to the same or similar elements. In accordance with methods and systems consistent with the present invention, an improved processor performance instrumentation system is provided that allows a software tester to measure more performance indicators than there are hardware counters during a single execution of a tested program. The improved processor performance instrumentation system accomplishes this by xe2x80x9cmultiplexingxe2x80x9d performance indicators while executing the tested program. In using such an improved processor performance system, the user chooses the performance indicators to measure. While the tested software program is running, systems or methods consistent with the present invention select one or more of the performance indicators, and measure and record the selected performance indicator during a pre-determined time period. Such an improved processor performance system then selects another one or more performance indicators, which are and measured and recorded during the predetermined time period. Such an improved processor performance system selects new performance indicators until all the user""s chosen performance indicators are measured. After measuring all the performance indicators, such methods and systems start over and measures all the performance indicators. Such methods and systems repeat until the tested program stops executing. Thus, the performance indicators are multiplexed during the execution of the tested program. This allows the software tester to measure, in one pass of the tested program, a greater number of performance indicators than there are hardware counters. FIG. 1 depicts a data processing system suitable for use with methods and systems consistent with the present invention. Computer 118 includes a memory 102, a secondary storage device 104, a processor 105 such as a central processing unit (CPU), an input device 106, and an output device 108. Input device 106 may comprise a keyboard, a mouse, or both. Output device 108 may be a cathode ray tube (CRT) that can display a graphical user interface (GUI). Memory 102 stores an application 109 used to multiplex multiple performance indicators. Memory 102 also contains a data storage space 120 for storing data while multiplexing application 109 is running. Memory 102 also stores a program 122 that multiplexing application 109 tests. Processor 105 comprises a first performance counter 112 and a second a performance counter 114. First performance counter 112 and second performance counter 114 each are capable of measuring one performance indicator at a single time. In another embodiment consistent with the present invention, there are more than two performance counters. In yet another embodiment consistent with the present invention, there is only one performance counter. The hardware counters are xe2x80x9cPerformance Instrumentation Countersxe2x80x9d and they count xe2x80x9cperformance indicators.xe2x80x9d For example, in the ULTRASPARC(trademark) processor available from SUN MICROSYSTEMS(trademark), there are two PICs, each of which can measure twelve performance indicators, but one at a time. Table I provides the performance indicator variable name and description for the first PIC in an ULTRASPARC(trademark). Table II provides the performance indicator variable name and description for the second PIC in an ULTRASPARC(trademark). As evident from the tables, some performance indicators are common to both the first PIC and the second PIC. Some performance indicators are found only on one of the two PICs. This table and a description of Performance Instrumentation is found in Appendix B of the ULTRASPARC(trademark) User""s Manual from SUN MICROSYSTEMS(trademark), July, 1997, which is incorporated herein by reference. FIG. 2 depicts a flowchart of the steps performed by the multiplexing application 109 in accordance with methods and systems consistent with the present invention. The first step performed by the multiplexing application 109 is to allow the user to choose a plurality of performance indicators (step 202). The user may do this through a GUI with a keyboard or mouse, or both. A list of all possible performance indicators be may stored in a data storage space 120. FIG. 3 depicts a more detailed diagram of data storage space 120, including a table 302 that includes a list of all the possible performance indicators in a first column 304. Multiplexing program 109 flags user chosen performance indicators by inserting a xe2x80x9cTRUExe2x80x9d in a second column 306. Performance indicators not chosen by the user are flagged xe2x80x9cFALSExe2x80x9d in the second column 306. The user may choose one or more performance indicators, including a number that is larger than the number of hardware counters present. The user chosen performance indicators will be measured by multiplexing application 109 while tested program 122 runs. Performance indicators not chosen will be ignored by multiplexing application 109. After the user chooses performance indicators, multiplexing application 109 then performs the step of determining a measured time period for measuring the user chosen performance indicators (step 204). To do this, program 109 may use a number of different algorithms. In one embodiment, the algorithm is based on the bit length of performance counters 112, 114 and the speed of processor 105. For instance, the bit-length of the performance counter in the SUN ULTRASPARC(trademark) processor is thirty-two bits. This means that the performance counter can count from a minimum of zero to a maximum of 232xe2x88x921 occurrences of a performance indicator. Once the performance counter reaches 232xe2x88x921, it xe2x80x9cwraps aroundxe2x80x9d quietly and starts counting at zero again. Therefore, multiplexing application 109 reads and records the performance counter data before it resets to zero. In general, if xe2x80x9cnxe2x80x9d represents the bit length of the performance counter, the wrap around time in seconds is 2n divided by the processor speed in cycles per second. Because of possible xe2x80x9cinterrupts,xe2x80x9d the measured time period, in this embodiment, is set to 80% of the wrap around time. During step 204, multiplexing application 109 also initializes a recorded data table 402, which is shown in FIG. 4 that depicts a more detailed diagram of data storage space 120. Recorded data table 402 stores data accumulated while multiplexing application 109 is running so that application 109 can display results at a later time. Data table 402 may be stored in data storage space 120. Recorded data table 402 includes a list of all the possible performance indicators in a first column 404. A second column 406 stores the total number of occurrences of each performance indicator while each is measured. A third column 408 stores the total time each performance indicator is measured. In one embodiment, a fourth column 410 stores the total number of clock cycles that have occurred while each performance indicator is measured. During step 204, multiplexing application 109 sets all of these values in second column 406, third column 408, and fourth column 410 to zero. Multiplexing application 109 then executes the tested program 122 (step 206). Tested program 122 is the program whose performance is measured. Multiplexing application then flags all the chosen performance indicators as unmeasured (step 208). FIG. 3 depicts a more detailed diagram of data storage space 120, including table 302 that includes a list of whether a performance indicator has been measured. Multiplexing application 109 flags measured performance indicators by inserting a xe2x80x9cTRUExe2x80x9d in third column 308. Unmeasured performance indicators are flagged xe2x80x9cFALSE.xe2x80x9d Performance indicators that will not be measured at all because the user did not choose them are flagged xe2x80x9cNULL.xe2x80x9d Multiplexing application 109 then selects two unmeasured performance indicators from the user chosen performance indicators (step 210). In another embodiment, if there is only one performance counter then the application 109 would only select one unmeasured performance indicator. Likewise, in the embodiment where there are more than two performance counters, then multiplexing application 109 selects a number of performance indicators equal to the number of performance counters. Multiplexing application 109 then instructs processor 105 to initialize performance counters 112, 114 to zero (step 212), and instructs processor 105 to measure the selected performance indicators (step 214) that multiplexing application 109 selected in step 210. Tested program 122 continues to execute (step 216). When the measured time period expires or when the tested program ends, multiplexing application 109 reads the performance counter data (step 218). This data is summed to the value in second column 406 corresponding to the appropriate selected performance indicators. Likewise, multiplexing application 109 increments the total time in third column 408 by the time the performance indicators were measured. Multiplexing application 109 then flags the two selected performance indicators as measured (step 220) by inserting a xe2x80x9cTRUExe2x80x9d in third column 308 of table 302. For instance, in table 302, the first performance indicator and the second performance indicator are flagged as measured. The third, sixth, seventh, eighth, and ninth performance indicators are flagged as unmeasured. The fourth and fifth performance indicators are flagged xe2x80x9cNULLxe2x80x9d because the user did not choose them for measurement. If tested program 122 has not ended (step 222), then the multiplexing application 109 determines if all the performance indicators are flagged as measured (step 224). If all the performance indicators are flagged as measured, then multiplexing application 109 flags all the performance indicators as unmeasured (step 208) and continues to step 210 to gather more data. If there are unmeasured performance indicators (step 224), then multiplexing application 109 selects two unmeasured performance indicators from the user chosen performance indicators (step 210) and continues to step 212. In another embodiment, multiplexing application 109 selects one new unmeasured performance indicator and retains the other previously selected performance indicator. For instance, the retained performance indicator may be the clock cycle count. Therefore, multiplexing application 109 may record the number of clock cycles during each measured time period. Multiplexing application places this data in fourth column 410 of recorded data table 402. If tested program 122 ended (step 222), multiplexing application 109 displays the results (step 226), for example on display device 103. To display results, multiplexing program 109 displays recorded data table 402. After displaying the results, multiplexing application 109 ends. One skilled in the art will appreciate that numerous variations to this system exist. For example, the measured time period can be selected in any fashion that is prevents the counters from resetting and losing data. As another example, the data may be tabulated and displayed in any fashion. Although methods and systems consistent with the present invention have been described with reference to a preferred embodiment thereof, those skilled in the art knows various changes in form and detail which may be made without departing from the spirit and scope of the present invention as defined in the appended claims and their full scope of equivalents.