US6249912B1 - Method and apparatus for determining most recently used methods - Google Patents

Method and apparatus for determining most recently used methods Download PDF

Info

Publication number
US6249912B1
US6249912B1 US09/425,338 US42533899A US6249912B1 US 6249912 B1 US6249912 B1 US 6249912B1 US 42533899 A US42533899 A US 42533899A US 6249912 B1 US6249912 B1 US 6249912B1
Authority
US
United States
Prior art keywords
routines
data collections
data
last time
weighted
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
US09/425,338
Inventor
Geoffrey Owen Blandy
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
International Business Machines Corp
Original Assignee
International Business Machines Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by International Business Machines Corp filed Critical International Business Machines Corp
Priority to US09/425,338 priority Critical patent/US6249912B1/en
Assigned to INTERNATIONAL BUSINESS MACHINES CORPORATION reassignment INTERNATIONAL BUSINESS MACHINES CORPORATION ASSIGNMENT OF ASSIGNORS INTEREST (SEE DOCUMENT FOR DETAILS). Assignors: BLANDY, GEOFFREY OWEN
Application granted granted Critical
Publication of US6249912B1 publication Critical patent/US6249912B1/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3409Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3409Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment
    • G06F11/3419Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment by assessing time
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/81Threshold
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/88Monitoring involving counting

Definitions

  • the present invention relates generally to an improved data processing system and in particular to a method and apparatus for predicting how frequently a routine may be executed in a data processing system. Still more particularly, the present invention provides a method and apparatus for predicting how frequently a method may be executed in a data processing system by determining most recently used methods in the data processing system.
  • Java is an object oriented programming language and environment that is designed to solve a number of problems in modern programming practice. Java is able to support applications for many types of data processing systems, which may contain a variety of central processing units and operating systems architectures.
  • a compiler typically generates an architecture—neutral file format—the compiled code is executable on many processors, given the presence of the Java run time system.
  • the Java compiler generates bytecode instructions that are non-specific to a particular computer architecture.
  • a bytecode is a machine independent code generated by the Java compiler and executed by a Java interpreter.
  • a Java interpreter is a module that alternatively decodes and executes a bytecode or bytecodes. These bytecode instructions are designed to be easy to interpret on any machine and easily translated on the fly into native machine code.
  • JIT just in time
  • the present invention provides a method in a data processing system for identifying recently used methods from a plurality of methods in a data processing system, wherein a counter is associated with each method within the plurality of methods. Periodic monitoring is performed to identify an executing method in a current period. The counter is divided using a number of periods since a last period during which the executing method was executed.
  • FIG. 1 is a block diagram of a data processing system in which the present invention may be implemented
  • FIG. 2 is a diagram of a timer in accordance with a preferred embodiment of the present invention.
  • FIG. 3 is a diagram of a method block in accordance with a preferred embodiment of the present invention.
  • FIG. 4 is a flowchart for initializing a method in accordance with a preferred embodiment of the present invention.
  • FIG. 5 is a flowchart of a process for sampling a method in response to a timer interrupt in accordance with a preferred embodiment of the present invention.
  • FIG. 6 is a flowchart of a process for identifying methods which have not been used frequently or recently.
  • Data processing system 100 employs a peripheral component interconnect (PCI) local bus architecture.
  • PCI peripheral component interconnect
  • Processor 102 and main memory 104 are connected to PCI local bus 106 through PCI bridge 108 .
  • PCI bridge 108 also may include an integrated memory controller and cache memory for processor 102 . Additional connections to PCI local bus 106 may be made through direct component interconnection or through add-in boards.
  • local area network (LAN) adapter 110 SCSI host bus adapter 112 , and expansion bus interface 114 are connected to PCI local bus 106 by direct component connection.
  • audio adapter 116 graphics adapter 118 , and audio/video adapter (A/V) 119 are connected to PCI local bus 106 by add-in boards inserted into expansion slots.
  • Expansion bus interface 114 provides a connection for a keyboard and mouse adapter 120 , modem 122 , and additional memory 124 .
  • SCSI host bus adapter 112 provides a connection for hard disk drive 126 , tape drive 128 , and CD-ROM 130 in the depicted example.
  • Typical PCI local bus implementations will support three or four PCI expansion slots or add-in connectors.
  • the hardware in FIG. 1 may vary.
  • other peripheral devices such as optical disk drives and the like may be used in addition to or in place of the hardware depicted in FIG. 1 .
  • the depicted example is not meant to imply architectural limitations with respect to the present invention.
  • the present invention provides a method, data processing system, and computer program product for identifying methods or routines that have consumed CPU processing time recently.
  • One means of predicting how frequently a routine may be executed in the near future is by determining how frequently the routine is executed in the recent past.
  • a technique for making such a determination may involve incrementing a counter when a method executes and periodically “sweeping” all such counters to reset or adjust them as time passes.
  • the counter may be divided by two at each sweep, providing for aging of the counts.
  • the counters may be updated using sampling (i.e. incremented for the method running at each timer tick) or may be rigorously maintained by incrementing for each invocation. Since it is important to determine not only the frequency of invocation but also the amount of time spent in the method, it may be necessary to count bytecode interpretation (very expensive in system resource) or branches taken (a bit more palatable). Sampling provides proportional time spent in a method with far less overhead albeit with reduced accuracy.
  • the sweep must be run periodically to adjust the counts so that they reflect recent activity. Otherwise, a method that accumulated millions of “ticks” early in the day could appear to be “hot” long after it became dormant. Because a typical system may have many thousand Java methods, the sweep is expensive. To combat this problem, a system designer may choose a longer period between sweeps. However, such a choice may be non-optimal for determining the truly hot methods.
  • Most recently used or most frequently accessed as used in the specification should be understood to mean frequent use, recently. As used, they are relative terms which are particular to a given situation.
  • the frequency of use is weighted by the recency of use to determine whether a particular method, routine or data is selected for inclusion in the limited resource.
  • the invention is used to select the top 1,000 or so methods which are most frequently and recently used from the total available pool of methods.
  • a larger or smaller proportion of a total available pool of elements can be selected depending upon the relative size of total available pool and the limited resource.
  • the present invention employs a timer based sampling process to track executing methods and eliminates the need for global counter reset (sweep) by simulating a sweep in each method that is detected when sampling occurs.
  • the present invention stores a timer in a method block, which contains information associated with a method or routine that is being monitored. Each time a timer interrupt occurs, each method that is running has its counter retrieved. Accordingly, each method that is running gains a higher aggregate number of times that it has been executing during an interrupt. For a more accurate reflection of use, each method's frequency of use is weighted by its recency of use such that methods being used more recently are more heavily weighted. As described above, this may include weighting the aggregate access count by the last time the method was accessed.
  • the timer stored in the method block is subtracted from the current timer to determine how much time has passed. From this amount of time, the number of periods that have passed is determined. The number of periods is used to calculate the number of sweep periods used to simulate sweeps by further weighting the frequency of use by the recency of use.
  • the entire timer may be stored in the method block. Of course, storage of the entire timer is not required for the present invention. A portion of the timer may be saved in the method block as described below in FIG. 2 .
  • Timer 200 is n bits in size and may be a hardware or a software timer. The timer is assumed to be increasing at a more or less a fixed rate.
  • x and y represent subsets of timer 200 in which y is the stepping rate that is more or less equal to the sweep period.
  • the capacity of the timer is represented by X, which is in bits. The portion of timer 200 between X and Y form a subset timer 202 .
  • the distance between X and Y within timer 200 determines the capacity of subset timer 202 .
  • X is typically set to minimize wrapping within subset timer 202 .
  • X also is set based on the amount of storage available. In particular, the amount of storage available to store subset timer 202 may be such that a smaller than ideal subset timer 202 is stored to meet the limitations on available storage, resulting in occurrence of some wrapping.
  • X and Y are saved into a method block, which is described below in FIG. 3 .
  • FIG. 3 a diagram of a method block is depicted in accordance with a preferred embodiment of the present invention.
  • Each method is associated with a method block, such as method block 300 .
  • a method block is a piece of storage defined within a class in the depicted example. Each method has its own method block in the depicted example.
  • Method block 300 is used to store information that is needed to interpret, run, and test a method or routine.
  • the present invention introduces a last period field 302 and a count field 304 located in counter 306 in method block 300 . These fields are used in the processes of the present invention to track how recently and frequently a method has been executing. The process identifies methods that have consumed CPU time recently.
  • each method that is to be monitored within the data processing system is tracked using last period field 302 and count field 304 .
  • last period field 302 and count field 304 are contained within a counter in method block 300 .
  • Count field 304 is similar to a counter that could be used currently to identify currently and frequently run methods using a sweep of methods.
  • FIG. 4 a flowchart for initializing a method is depicted in accordance with a preferred embodiment of the present invention.
  • the process in FIG. 4 is used to initialize a method so that the frequency and regency of execution of the method can be tracked using the processes of the present invention.
  • the process begins by setting the last period field in the method equal to the current period (step 400 ). Thereafter, the count field is set equal to zero (step 402 ).
  • FIG. 5 a flowchart of a process for sampling a method in response to a timer interrupt is depicted in accordance with a preferred embodiment of the present invention.
  • Each time a timer interrupt occurs each method that is running has its counter retrieved.
  • the counter contains two fields as described above in FIG. 3 .
  • Last period field 302 represents the last time that this field was visited, e.g., either at initializing of the field or through a timer interrupt.
  • Each method that had its counter retrieved must be credited with a higher frequency of use value. For a more accurate reflection of use, each method's frequency of use is weighted by its recency of use.
  • last period field 302 is subtracted from the corresponding subset of the current timer 202 to determine the number of periods that have passed since the execution of this method was last detected.
  • the number of periods may further be weighted by the recency of use.
  • the depicted example employs a hardware timer in which only a portion of the timer is saved in last period field 302 .
  • the entire timer may be saved in period field 302 .
  • the method for determining the numbers of elapsed periods would involve subtraction and division.
  • Last period field 302 would be subtracted from the current timer to determine the amount of time that had elapsed and the result would be divided by the number of timer ticks that comprise the sweep period.
  • Count field 304 is then adjusted to simulate n sweeps. For example, in the case where simulating a sweep that causes each count field to be divided by 2, the simulation of n sweeps would be accomplished by shifting count field 304 right n bits. The sweep simulation decreases the weight of the count field's frequency of use value according to recency of use. Thus, the frequency of use is weighted by the recency of use. Following the sweep adjustment, count field 304 is incremented by 1 and a determination is made as to whether an action should be taken.
  • the count field 304 is incremented after the sweep simulation because the new increment's weight represents the most recent time the method could have run and thus, that count increment has a higher frequency of use as weighted by the recency of use. Thus, routines having a later last time of execution are weighted more heavily in the count field than routines having an earlier last time of execution.
  • the action may be scheduling just in time compilation of the method.
  • the process begins by setting the variable CM equal to the current method (step 500 ). Thereafter, CM.Count is shifted right by Current_Period_CM.Last_Period (step 502 ). This step illustrates the subtraction of the sweep period from the portion of the system timer that represents the same period. Additionally in step 502 , the value of the count field is shifted right by the difference to simulate n sweeps. In the depicted example, a counter is divided by two for each simulated sweep (shifting right by one simulates the division by two). Next, CM.Last_Period is set equal to the Current_Period (step 504 ). Step 504 basically saves the current period in last period field 302 . The process then adds one to CM.Count, which is the count field for the current method (step 506 ).
  • CM.Count is greater than a high threshold value (step 508 ). If CM.Count is greater than the high threshold value, a high threshold action is taken (step 510 ) with the process terminating thereafter. For example, if CM.Count is greater than a selected threshold, an action, such as scheduling the method for JIT compilation in the case of a Java method. The selection of the threshold would depend on various factors, such as, for example, the amount of storage available and the aggressiveness selected to JIT a method. Of course, other actions may be taken depending on what is being monitored and the operating system environment For example, the invention could be used in a caching or page replacement process rather than selecting methods for JIT compilation).
  • CM.Count is less than or equal to the high threshold, a determination is then made as to whether CM.Count is less than a low threshold value (step 512 ). If CM.Count is less than the low threshold value, a low threshold action is taken (step 514 ).
  • Various actions may be taken at a lower threshold value, for example scheduling the release of storage currently used to hold the compiled version of a method or the migration of a storage element (e.g., page or cached item) to a lower level of the storage hierarchy. Note, however, that low threshold actions are more likely to occur in response to the detection of resource shortage,described in FIG. 6 .
  • FIG. 6 describes the process of determining the methods that have not been used recently and frequently, ie. low threshold detection. This process would most typically be employed in response to some critical resource shortage and would identify those holders of the critical resource that would be the best candidates for release of said resource.
  • the process low threshold detection begins by identifying a holder of the critical resource, RH (step 600 ).
  • the counter is adjusted to account for the time that has elapsed since the method was last seen to be executing. Note that this step is identical to step 502 of FIG. 5 where further details of this step may be found.
  • the adjusted count is compared to a low threshold value and if it is lower, step 606 is performed wherein, for example, the resource previously held by RH may be released.
  • the processes of the present invention may be applied to other applications other than JIT compilation of bytecodes.
  • the present invention also may be applied to migration of data in a storage hierarchy.
  • the processes described may be applied to caching and paging of data with a data processing system.
  • the present invention may be used to identify how often data is used or accessed within the data processing system. Data which is frequently used or accessed would be kept in the cache.
  • the embodiment was chosen and described in order to best explain the principles of the invention and the practical application to enable others of ordinary skill in the art to understand the invention for various embodiments with various modifications as are suited to the particular use contemplated.

Abstract

A method in a data processing system for identifying recently used methods from a plurality of methods in a data processing system, wherein a counter is associated with each method within the plurality of methods. Periodic monitoring is performed to identify an executing method in a current period. The counter is divided using a number of periods since a last period during which the executing method was executed.

Description

This application is a division of 09/078,932 filed on May 14, 1998.
BACKGROUND OF THE INVENTION
1. Technical Field
The present invention relates generally to an improved data processing system and in particular to a method and apparatus for predicting how frequently a routine may be executed in a data processing system. Still more particularly, the present invention provides a method and apparatus for predicting how frequently a method may be executed in a data processing system by determining most recently used methods in the data processing system.
2. Description of Related Art
Java is an object oriented programming language and environment that is designed to solve a number of problems in modern programming practice. Java is able to support applications for many types of data processing systems, which may contain a variety of central processing units and operating systems architectures. To enable a Java application to execute on different types of data processing systems, a compiler typically generates an architecture—neutral file format—the compiled code is executable on many processors, given the presence of the Java run time system. The Java compiler generates bytecode instructions that are non-specific to a particular computer architecture. A bytecode is a machine independent code generated by the Java compiler and executed by a Java interpreter. A Java interpreter is a module that alternatively decodes and executes a bytecode or bytecodes. These bytecode instructions are designed to be easy to interpret on any machine and easily translated on the fly into native machine code.
Selective just in time (JIT) compilation is a recent and important development in Java. Tremendous storage savings can be achieved by compiling only the most frequently executed methods. Additionally, compile time is not wasted on infrequently executed methods. For example, there are many Java methods that are executed only once if at all in a given session and it would take much more time to compile and run all of these than to just interpret them. With JIT compilation, however, one issue that remains is selecting a process for determining which methods are frequently executed methods. In addition, it would be desirable to determine which methods are frequently and recently executed methods.
Therefore, it would be advantageous to have an improved method and apparatus for identifying the most frequently recently executed methods.
SUMMARY OF THE INVENTION
It is one object of the present invention to provide an improved data processing system.
It is another object of the present invention to provide a method and apparatus for predicting how frequently a routine may be executed in a data processing system.
It is yet another object of the present invention for predicting how frequently a method may be executed in a data processing system by determining most recently used methods in the data processing system.
The present invention provides a method in a data processing system for identifying recently used methods from a plurality of methods in a data processing system, wherein a counter is associated with each method within the plurality of methods. Periodic monitoring is performed to identify an executing method in a current period. The counter is divided using a number of periods since a last period during which the executing method was executed.
BRIEF DESCRIPTION OF THE DRAWINGS
The novel features believed characteristic of the invention are set forth in the appended claims. The invention itself, however, as well as a preferred mode of use, further objectives and advantages thereof, will best be understood by reference to the following detailed description of an illustrative embodiment when read in conjunction with the accompanying drawings, wherein:
FIG. 1 is a block diagram of a data processing system in which the present invention may be implemented;
FIG. 2 is a diagram of a timer in accordance with a preferred embodiment of the present invention;
FIG. 3 is a diagram of a method block in accordance with a preferred embodiment of the present invention;
FIG. 4 is a flowchart for initializing a method in accordance with a preferred embodiment of the present invention; and
FIG. 5 is a flowchart of a process for sampling a method in response to a timer interrupt in accordance with a preferred embodiment of the present invention.
FIG. 6 is a flowchart of a process for identifying methods which have not been used frequently or recently.
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT
With reference now to the figures, and in particular with reference to FIG. 1, a block diagram of a data processing system 100 in which the present invention may be implemented is illustrated. Data processing system 100 employs a peripheral component interconnect (PCI) local bus architecture. Although the depicted example employs a PCI bus, other bus architectures such as Micro Channel and ISA may be used. Processor 102 and main memory 104 are connected to PCI local bus 106 through PCI bridge 108. PCI bridge 108 also may include an integrated memory controller and cache memory for processor 102. Additional connections to PCI local bus 106 may be made through direct component interconnection or through add-in boards. In the depicted example, local area network (LAN) adapter 110, SCSI host bus adapter 112, and expansion bus interface 114 are connected to PCI local bus 106 by direct component connection. In contrast, audio adapter 116, graphics adapter 118, and audio/video adapter (A/V) 119 are connected to PCI local bus 106 by add-in boards inserted into expansion slots. Expansion bus interface 114 provides a connection for a keyboard and mouse adapter 120, modem 122, and additional memory 124. SCSI host bus adapter 112 provides a connection for hard disk drive 126, tape drive 128, and CD-ROM 130 in the depicted example. Typical PCI local bus implementations will support three or four PCI expansion slots or add-in connectors. Those of ordinary skill in the art will appreciate that the hardware in FIG. 1 may vary. For example, other peripheral devices, such as optical disk drives and the like may be used in addition to or in place of the hardware depicted in FIG. 1. The depicted example is not meant to imply architectural limitations with respect to the present invention. The present invention provides a method, data processing system, and computer program product for identifying methods or routines that have consumed CPU processing time recently. One means of predicting how frequently a routine may be executed in the near future is by determining how frequently the routine is executed in the recent past. A technique for making such a determination may involve incrementing a counter when a method executes and periodically “sweeping” all such counters to reset or adjust them as time passes. For example, the counter may be divided by two at each sweep, providing for aging of the counts.
The counters may be updated using sampling (i.e. incremented for the method running at each timer tick) or may be rigorously maintained by incrementing for each invocation. Since it is important to determine not only the frequency of invocation but also the amount of time spent in the method, it may be necessary to count bytecode interpretation (very expensive in system resource) or branches taken (a bit more palatable). Sampling provides proportional time spent in a method with far less overhead albeit with reduced accuracy.
The sweep must be run periodically to adjust the counts so that they reflect recent activity. Otherwise,a method that accumulated millions of “ticks” early in the day could appear to be “hot” long after it became dormant. Because a typical system may have many thousand Java methods, the sweep is expensive. To combat this problem, a system designer may choose a longer period between sweeps. However, such a choice may be non-optimal for determining the truly hot methods.
Most recently used or most frequently accessed as used in the specification should be understood to mean frequent use, recently. As used, they are relative terms which are particular to a given situation. Using the weighting technique as described in the patent, the frequency of use is weighted by the recency of use to determine whether a particular method, routine or data is selected for inclusion in the limited resource. Using the example of the JIT compilation of potentially 60,000 to 100,000 Java methods, only perhaps 1,000 to 2,000 methods will fit in a JIT buffer of one megabyte. Therefore, in this situation, the invention is used to select the top 1,000 or so methods which are most frequently and recently used from the total available pool of methods. Of course, one skilled in the art would understand that in different embodiments of the invention a larger or smaller proportion of a total available pool of elements can be selected depending upon the relative size of total available pool and the limited resource.
The present invention employs a timer based sampling process to track executing methods and eliminates the need for global counter reset (sweep) by simulating a sweep in each method that is detected when sampling occurs. The present invention stores a timer in a method block, which contains information associated with a method or routine that is being monitored. Each time a timer interrupt occurs, each method that is running has its counter retrieved. Accordingly, each method that is running gains a higher aggregate number of times that it has been executing during an interrupt. For a more accurate reflection of use, each method's frequency of use is weighted by its recency of use such that methods being used more recently are more heavily weighted. As described above, this may include weighting the aggregate access count by the last time the method was accessed. Thus, when a timer interrupt occurs, the timer stored in the method block is subtracted from the current timer to determine how much time has passed. From this amount of time, the number of periods that have passed is determined. The number of periods is used to calculate the number of sweep periods used to simulate sweeps by further weighting the frequency of use by the recency of use. Depending upon the implementation, the entire timer may be stored in the method block. Of course, storage of the entire timer is not required for the present invention. A portion of the timer may be saved in the method block as described below in FIG. 2.
Turning now to FIG. 2, a diagram of a timer is depicted in accordance with a preferred embodiment of the present invention. A timer is used to initiate sampling of methods executing in a data processing system. Timer 200 is n bits in size and may be a hardware or a software timer. The timer is assumed to be increasing at a more or less a fixed rate. In timer 200, x and y represent subsets of timer 200 in which y is the stepping rate that is more or less equal to the sweep period. The capacity of the timer is represented by X, which is in bits. The portion of timer 200 between X and Y form a subset timer 202. The distance between X and Y within timer 200 determines the capacity of subset timer 202. X is typically set to minimize wrapping within subset timer 202. X also is set based on the amount of storage available. In particular, the amount of storage available to store subset timer 202 may be such that a smaller than ideal subset timer 202 is stored to meet the limitations on available storage, resulting in occurrence of some wrapping. X and Y are saved into a method block, which is described below in FIG. 3.
Turning next to FIG. 3, a diagram of a method block is depicted in accordance with a preferred embodiment of the present invention. Each method is associated with a method block, such as method block 300. A method block is a piece of storage defined within a class in the depicted example. Each method has its own method block in the depicted example. Method block 300 is used to store information that is needed to interpret, run, and test a method or routine. In addition, the present invention introduces a last period field 302 and a count field 304 located in counter 306 in method block 300. These fields are used in the processes of the present invention to track how recently and frequently a method has been executing. The process identifies methods that have consumed CPU time recently. In determining which methods have been run most recently frequently, each method that is to be monitored within the data processing system is tracked using last period field 302 and count field 304. In the depicted example, last period field 302 and count field 304 are contained within a counter in method block 300. Count field 304 is similar to a counter that could be used currently to identify currently and frequently run methods using a sweep of methods. Whereas the above description and associated figure describe a method block as the location of the last period and count fields, the invention could be practiced by locating these fields in some other control block or hash table. Indeed, such an alternate location would be necessary when using this invention for monitoring procedures other than Java method usage.
With reference now to FIG. 4, a flowchart for initializing a method is depicted in accordance with a preferred embodiment of the present invention. The process in FIG. 4 is used to initialize a method so that the frequency and regency of execution of the method can be tracked using the processes of the present invention. The process begins by setting the last period field in the method equal to the current period (step 400). Thereafter, the count field is set equal to zero (step 402).
Turning now to FIG. 5, a flowchart of a process for sampling a method in response to a timer interrupt is depicted in accordance with a preferred embodiment of the present invention. Each time a timer interrupt occurs, each method that is running has its counter retrieved. The counter contains two fields as described above in FIG. 3. Last period field 302 represents the last time that this field was visited, e.g., either at initializing of the field or through a timer interrupt. Each method that had its counter retrieved must be credited with a higher frequency of use value. For a more accurate reflection of use, each method's frequency of use is weighted by its recency of use. In the present invention, last period field 302 is subtracted from the corresponding subset of the current timer 202 to determine the number of periods that have passed since the execution of this method was last detected. The number of periods may further be weighted by the recency of use. Although different types of timers may be implemented, the depicted example employs a hardware timer in which only a portion of the timer is saved in last period field 302. Alternatively, the entire timer may be saved in period field 302. In this case, the method for determining the numbers of elapsed periods would involve subtraction and division. Last period field 302 would be subtracted from the current timer to determine the amount of time that had elapsed and the result would be divided by the number of timer ticks that comprise the sweep period. In either case, the result, n, indicates the number of sweep periods that have passed since the method was last visited. Count field 304 is then adjusted to simulate n sweeps. For example, in the case where simulating a sweep that causes each count field to be divided by 2, the simulation of n sweeps would be accomplished by shifting count field 304 right n bits. The sweep simulation decreases the weight of the count field's frequency of use value according to recency of use. Thus, the frequency of use is weighted by the recency of use. Following the sweep adjustment, count field 304 is incremented by 1 and a determination is made as to whether an action should be taken. The count field 304 is incremented after the sweep simulation because the new increment's weight represents the most recent time the method could have run and thus, that count increment has a higher frequency of use as weighted by the recency of use. Thus, routines having a later last time of execution are weighted more heavily in the count field than routines having an earlier last time of execution. In the depicted example, the action may be scheduling just in time compilation of the method.
Still with reference to FIG. 5, the process begins by setting the variable CM equal to the current method (step 500). Thereafter, CM.Count is shifted right by Current_Period_CM.Last_Period (step 502). This step illustrates the subtraction of the sweep period from the portion of the system timer that represents the same period. Additionally in step 502, the value of the count field is shifted right by the difference to simulate n sweeps. In the depicted example, a counter is divided by two for each simulated sweep (shifting right by one simulates the division by two). Next, CM.Last_Period is set equal to the Current_Period (step 504). Step 504 basically saves the current period in last period field 302. The process then adds one to CM.Count, which is the count field for the current method (step 506).
Next, a determination is made as to whether CM.Count is greater than a high threshold value (step 508). If CM.Count is greater than the high threshold value, a high threshold action is taken (step 510) with the process terminating thereafter. For example, if CM.Count is greater than a selected threshold, an action, such as scheduling the method for JIT compilation in the case of a Java method. The selection of the threshold would depend on various factors, such as, for example, the amount of storage available and the aggressiveness selected to JIT a method. Of course, other actions may be taken depending on what is being monitored and the operating system environment For example, the invention could be used in a caching or page replacement process rather than selecting methods for JIT compilation).
If CM.Count is less than or equal to the high threshold, a determination is then made as to whether CM.Count is less than a low threshold value (step 512). If CM.Count is less than the low threshold value, a low threshold action is taken (step 514).
Various actions may be taken at a lower threshold value, for example scheduling the release of storage currently used to hold the compiled version of a method or the migration of a storage element (e.g., page or cached item) to a lower level of the storage hierarchy. Note, however, that low threshold actions are more likely to occur in response to the detection of resource shortage,described in FIG. 6.
FIG. 6 describes the process of determining the methods that have not been used recently and frequently, ie. low threshold detection. This process would most typically be employed in response to some critical resource shortage and would identify those holders of the critical resource that would be the best candidates for release of said resource.
With reference to FIG. 6, the process low threshold detection begins by identifying a holder of the critical resource, RH (step 600). Next, in step 602, the counter is adjusted to account for the time that has elapsed since the method was last seen to be executing. Note that this step is identical to step 502 of FIG. 5 where further details of this step may be found. In step 604, the adjusted count is compared to a low threshold value and if it is lower, step 606 is performed wherein, for example, the resource previously held by RH may be released.
It is important to note that while the present invention has been described in the context of a fully functioning data processing system, those of ordinary skill in the art will appreciate that the processes of the present invention are capable of being distributed in a form of a computer readable medium of instructions and a variety of forms and that the present invention applies equally regardless of the particular type of signal bearing media actually used to carry out the distribution. Examples of computer readable media include recordable-type media such a floppy disc, a hard disk drive, a RAM, and CD-ROMs and transmission-type media such as digital and analog communications links.
The description of the present invention has been presented for purposes of illustration and description, but is not limited to be exhaustive or limited to the invention in the form disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art. For example, the processes of the present invention may be applied to other applications other than JIT compilation of bytecodes. In particular, the present invention also may be applied to migration of data in a storage hierarchy. For example, the processes described may be applied to caching and paging of data with a data processing system. In particular, the present invention may be used to identify how often data is used or accessed within the data processing system. Data which is frequently used or accessed would be kept in the cache. The embodiment was chosen and described in order to best explain the principles of the invention and the practical application to enable others of ordinary skill in the art to understand the invention for various embodiments with various modifications as are suited to the particular use contemplated.

Claims (7)

What is claimed is:
1. A method for identifying recently and frequently used routines in a data processing system, the method comprising the steps of:
for a collection period, tracking an aggregate number of times each of a plurality of routines executes;
for the collection period, determining a last time each of the plurality of routines executes;
weighting the aggregate number of times each routine executes by the last time that the routine executed to produce a weighted aggregate execution count for each of the plurality of routines so that routines having a later last time of execution are weighted more heavily than routines having an earlier last time of execution; and
selecting a number of routines from the plurality of routines as the more recently and frequently used routines according to the weighted execution counts.
2. The method of claim 1, wherein the number of routines are processed using JIT compilation.
3. The method of claim 1, wherein data associated with the number of routines are cached.
4. A method for identifying recent access of data collections within a data processing system, the method comprising the steps of:
for a collection period, tracking an aggregate number of times each of a plurality of data collections is accessed;
for the collection period, determining a last time each of the plurality of data collections was accessed;
weighting the aggregate number of times each data collection was accessed by the last time that the data collection was accessed to produce a weighted aggregate access count for each of the plurality of data collections so that data collections having a later last time of access are weighted more heavily than data collections having an earlier last time of access; and
selecting a number of data collections from the plurality of data collections as the most recently and frequently used data collections according to the weighted access counts.
5. The method of claim 4, wherein the plurality data collections is a plurality of routines.
6. The method of claim 4, wherein the number of data collections are stored in a cache.
7. The method of claim 4, wherein the plurality of data collections are a plurality of pages.
US09/425,338 1998-05-14 1999-10-22 Method and apparatus for determining most recently used methods Expired - Fee Related US6249912B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US09/425,338 US6249912B1 (en) 1998-05-14 1999-10-22 Method and apparatus for determining most recently used methods

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
US09/078,932 US6321375B1 (en) 1998-05-14 1998-05-14 Method and apparatus for determining most recently used method
US09/425,338 US6249912B1 (en) 1998-05-14 1999-10-22 Method and apparatus for determining most recently used methods

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
US09/078,932 Division US6321375B1 (en) 1998-05-14 1998-05-14 Method and apparatus for determining most recently used method

Publications (1)

Publication Number Publication Date
US6249912B1 true US6249912B1 (en) 2001-06-19

Family

ID=22147103

Family Applications (2)

Application Number Title Priority Date Filing Date
US09/078,932 Expired - Fee Related US6321375B1 (en) 1998-05-14 1998-05-14 Method and apparatus for determining most recently used method
US09/425,338 Expired - Fee Related US6249912B1 (en) 1998-05-14 1999-10-22 Method and apparatus for determining most recently used methods

Family Applications Before (1)

Application Number Title Priority Date Filing Date
US09/078,932 Expired - Fee Related US6321375B1 (en) 1998-05-14 1998-05-14 Method and apparatus for determining most recently used method

Country Status (1)

Country Link
US (2) US6321375B1 (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020144240A1 (en) * 2001-03-29 2002-10-03 Guei-Yuan Lueh Method and system of controlling dynamically compiled native code size
US20030084018A1 (en) * 2001-10-31 2003-05-01 Murthy Chintalapati Server-based application monitoring through collection of application component and environmental statistics
US20050198620A1 (en) * 2004-03-05 2005-09-08 Mathiske Bernd J. Method and apparatus for determining frequency of execution for compiled methods within a virtual machine
US7103877B1 (en) * 2000-11-01 2006-09-05 International Business Machines Corporation System and method for characterizing program behavior by sampling at selected program points
US20060206884A1 (en) * 2005-03-08 2006-09-14 International Business Machines Corporation Late binding of optimization information for just in time compilation
US20100005457A1 (en) * 2008-07-07 2010-01-07 International Business Machines Corporation Method of reducing logging code in a computing system
US7970722B1 (en) 1999-11-08 2011-06-28 Aloft Media, Llc System, method and computer program product for a collaborative decision platform

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7058928B2 (en) * 1999-12-23 2006-06-06 Identify Software Ltd. System and method for conditional tracing of computer programs
US20020087949A1 (en) * 2000-03-03 2002-07-04 Valery Golender System and method for software diagnostics using a combination of visual and dynamic tracing
US8312435B2 (en) * 2000-12-26 2012-11-13 Identify Software Ltd. (IL) System and method for conditional tracing of computer programs
EP1360584A1 (en) * 2001-02-12 2003-11-12 Trimedia Technologies, Inc. An optimized dynamic bytecode interpreter
US6996814B2 (en) * 2001-11-14 2006-02-07 Sun Microsystems, Inc. Method and apparatus for dynamically compiling byte codes into native code
US7386839B1 (en) 2002-11-06 2008-06-10 Valery Golender System and method for troubleshooting software configuration problems using application tracing
US8032866B1 (en) 2003-03-27 2011-10-04 Identify Software Ltd. System and method for troubleshooting runtime software problems using application learning
US7827539B1 (en) 2004-06-25 2010-11-02 Identify Software Ltd. System and method for automated tuning of program execution tracing
US8762952B2 (en) 2010-12-14 2014-06-24 Bmc Software, Inc. Recording method calls that led to an unforeseen problem
US8745598B2 (en) 2010-12-14 2014-06-03 Bmc Software, Inc. Running injected code prior to execution of an application

Citations (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4008460A (en) 1975-12-24 1977-02-15 International Business Machines Corporation Circuit for implementing a modified LRU replacement algorithm for a cache
US4168541A (en) 1978-09-25 1979-09-18 Sperry Rand Corporation Paired least recently used block replacement system
US4432051A (en) * 1973-11-30 1984-02-14 Honeywell Information Systems Inc. Process execution time accounting system
US4455602A (en) 1981-05-22 1984-06-19 Data General Corporation Digital data processing system having an I/O means using unique address providing and access priority control techniques
US4607331A (en) 1983-05-13 1986-08-19 Motorola, Inc. Method and apparatus for implementing an algorithm associated with stored information
US5212794A (en) * 1990-06-01 1993-05-18 Hewlett-Packard Company Method for optimizing computer code to provide more efficient execution on computers having cache memories
US5224217A (en) 1988-12-30 1993-06-29 Saied Zangenehpour Computer system which uses a least-recently-used algorithm for manipulating data tags when performing cache replacement
US5287508A (en) * 1992-04-07 1994-02-15 Sun Microsystems, Inc. Method and apparatus for efficient scheduling in a multiprocessor system
US5297248A (en) * 1990-06-28 1994-03-22 International Business Machines Corporation Multi-color animation of computer program execution
US5526511A (en) 1993-12-23 1996-06-11 Unisys Corporation Enhanced least recently used round robin cache management method and apparatus for allocation and destaging of cache segments
US5548742A (en) 1994-08-11 1996-08-20 Intel Corporation Method and apparatus for combining a direct-mapped cache and a multiple-way cache in a cache memory
US5701489A (en) * 1995-06-06 1997-12-23 International Business Machines Corporation System for partial in-line expansion of procedure calls during program compilation
US5754766A (en) 1991-04-17 1998-05-19 Shaw; Venson M. Integrated circuit system for direct document execution
US5809528A (en) 1996-12-24 1998-09-15 International Business Machines Corporation Method and circuit for a least recently used replacement mechanism and invalidated address handling in a fully associative many-way cache memory
US5857097A (en) * 1997-03-10 1999-01-05 Digital Equipment Corporation Method for identifying reasons for dynamic stall cycles during the execution of a program
US5909566A (en) 1996-12-31 1999-06-01 Texas Instruments Incorporated Microprocessor circuits, systems, and methods for speculatively executing an instruction using its most recently used data while concurrently prefetching data for the instruction
US5999737A (en) * 1994-03-01 1999-12-07 Digital Equipment Corporation Link time optimization via dead code elimination, code motion, code partitioning, code grouping, loop analysis with code motion, loop invariant analysis and active variable to register analysis
US6002875A (en) * 1996-10-16 1999-12-14 Nec Corporation Method for the reduction of instruction cache miss rate using optimization data from trace data profiles
US6112317A (en) * 1997-03-10 2000-08-29 Digital Equipment Corporation Processor performance counter for sampling the execution frequency of individual instructions

Patent Citations (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4432051A (en) * 1973-11-30 1984-02-14 Honeywell Information Systems Inc. Process execution time accounting system
US4008460A (en) 1975-12-24 1977-02-15 International Business Machines Corporation Circuit for implementing a modified LRU replacement algorithm for a cache
US4168541A (en) 1978-09-25 1979-09-18 Sperry Rand Corporation Paired least recently used block replacement system
US4455602A (en) 1981-05-22 1984-06-19 Data General Corporation Digital data processing system having an I/O means using unique address providing and access priority control techniques
US4607331A (en) 1983-05-13 1986-08-19 Motorola, Inc. Method and apparatus for implementing an algorithm associated with stored information
US5224217A (en) 1988-12-30 1993-06-29 Saied Zangenehpour Computer system which uses a least-recently-used algorithm for manipulating data tags when performing cache replacement
US5212794A (en) * 1990-06-01 1993-05-18 Hewlett-Packard Company Method for optimizing computer code to provide more efficient execution on computers having cache memories
US5297248A (en) * 1990-06-28 1994-03-22 International Business Machines Corporation Multi-color animation of computer program execution
US5754766A (en) 1991-04-17 1998-05-19 Shaw; Venson M. Integrated circuit system for direct document execution
US5287508A (en) * 1992-04-07 1994-02-15 Sun Microsystems, Inc. Method and apparatus for efficient scheduling in a multiprocessor system
US5526511A (en) 1993-12-23 1996-06-11 Unisys Corporation Enhanced least recently used round robin cache management method and apparatus for allocation and destaging of cache segments
US5999737A (en) * 1994-03-01 1999-12-07 Digital Equipment Corporation Link time optimization via dead code elimination, code motion, code partitioning, code grouping, loop analysis with code motion, loop invariant analysis and active variable to register analysis
US5548742A (en) 1994-08-11 1996-08-20 Intel Corporation Method and apparatus for combining a direct-mapped cache and a multiple-way cache in a cache memory
US5701489A (en) * 1995-06-06 1997-12-23 International Business Machines Corporation System for partial in-line expansion of procedure calls during program compilation
US6002875A (en) * 1996-10-16 1999-12-14 Nec Corporation Method for the reduction of instruction cache miss rate using optimization data from trace data profiles
US5809528A (en) 1996-12-24 1998-09-15 International Business Machines Corporation Method and circuit for a least recently used replacement mechanism and invalidated address handling in a fully associative many-way cache memory
US5909566A (en) 1996-12-31 1999-06-01 Texas Instruments Incorporated Microprocessor circuits, systems, and methods for speculatively executing an instruction using its most recently used data while concurrently prefetching data for the instruction
US5857097A (en) * 1997-03-10 1999-01-05 Digital Equipment Corporation Method for identifying reasons for dynamic stall cycles during the execution of a program
US6009514A (en) * 1997-03-10 1999-12-28 Digital Equipment Corporation Computer method and apparatus for analyzing program instructions executing in a computer system
US6112317A (en) * 1997-03-10 2000-08-29 Digital Equipment Corporation Processor performance counter for sampling the execution frequency of individual instructions

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7970722B1 (en) 1999-11-08 2011-06-28 Aloft Media, Llc System, method and computer program product for a collaborative decision platform
US8160988B1 (en) 1999-11-08 2012-04-17 Aloft Media, Llc System, method and computer program product for a collaborative decision platform
US8005777B1 (en) 1999-11-08 2011-08-23 Aloft Media, Llc System, method and computer program product for a collaborative decision platform
US7103877B1 (en) * 2000-11-01 2006-09-05 International Business Machines Corporation System and method for characterizing program behavior by sampling at selected program points
US20020144240A1 (en) * 2001-03-29 2002-10-03 Guei-Yuan Lueh Method and system of controlling dynamically compiled native code size
US7350200B2 (en) * 2001-03-29 2008-03-25 Intel Corporation Method and system of controlling dynamically compiled native code size
US20030084018A1 (en) * 2001-10-31 2003-05-01 Murthy Chintalapati Server-based application monitoring through collection of application component and environmental statistics
EP1308844A3 (en) * 2001-10-31 2005-09-07 Sun Microsystems, Inc. System and method for monitoring an application on a server
US7216160B2 (en) 2001-10-31 2007-05-08 Sun Microsystems, Inc. Server-based application monitoring through collection of application component and environmental statistics
US20050198620A1 (en) * 2004-03-05 2005-09-08 Mathiske Bernd J. Method and apparatus for determining frequency of execution for compiled methods within a virtual machine
EP1589425A3 (en) * 2004-03-05 2008-07-23 Sun Microsystems, Inc. Method and apparatus for determining frequency of execution for compiled methods within a virtual machine
US7568190B2 (en) * 2005-03-08 2009-07-28 International Business Machines Corporation Late binding of optimization information for just in time compilation
US20060206884A1 (en) * 2005-03-08 2006-09-14 International Business Machines Corporation Late binding of optimization information for just in time compilation
US20100005457A1 (en) * 2008-07-07 2010-01-07 International Business Machines Corporation Method of reducing logging code in a computing system
US8327342B2 (en) * 2008-07-07 2012-12-04 International Business Machines Corporation Method of reducing logging code in a computing system

Also Published As

Publication number Publication date
US6321375B1 (en) 2001-11-20

Similar Documents

Publication Publication Date Title
US6249912B1 (en) Method and apparatus for determining most recently used methods
US6189141B1 (en) Control path evaluating trace designator with dynamically adjustable thresholds for activation of tracing for high (hot) activity and low (cold) activity of flow control
US5950009A (en) Method and apparatus for profile-based reordering of program portions in a computer program
US6029004A (en) Method and apparatus for modular reordering of portions of a computer program based on profile data
US5579520A (en) System and methods for optimizing compiled code according to code object participation in program activities
US7765527B2 (en) Per thread buffering for storing profiling data
US5446876A (en) Hardware mechanism for instruction/data address tracing
US6067412A (en) Automatic bottleneck detection by means of workload reconstruction from performance measurements
US7383417B2 (en) Prefetching apparatus, prefetching method and prefetching program product
US7574587B2 (en) Method and apparatus for autonomically initiating measurement of secondary metrics based on hardware counter values for primary metrics
US5528753A (en) System and method for enabling stripped object software monitoring in a computer system
CA2672337C (en) Compiler instrumentation infrastructure to facilitate multiple pass and multiple purpose dynamic analysis
US7421684B2 (en) Method and apparatus for autonomic test case feedback using hardware assistance for data coverage
US20060230391A1 (en) System and method for collecting a plurality of metrics in a single profiling run of computer code
US20060230390A1 (en) Instruction profiling using multiple metrics
JP2005018760A (en) System and method for facilitating profiling of application
JPH11272476A (en) Method and device for dynamically optimizing byte-coded program
CN100338581C (en) Operating system-independent method and system of determining CPU utilization
US6865736B2 (en) Static cache
WO2004059440A2 (en) System and method for memory leak detection in a virtual machine environment
JP2013033412A (en) Memory management method, program, and system
JP2012038359A (en) Method and apparatus for determining frequency of execution of compiled methods within virtual machine
US8000953B2 (en) Augmenting of automated clustering-based trace sampling methods by user-directed phase detection
US11636122B2 (en) Method and apparatus for data mining from core traces
US6339818B1 (en) Method and system for dynamically locating frequently accessed memory regions or locations

Legal Events

Date Code Title Description
AS Assignment

Owner name: INTERNATIONAL BUSINESS MACHINES CORPORATION, NEW Y

Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:BLANDY, GEOFFREY OWEN;REEL/FRAME:010342/0179

Effective date: 19991022

FEPP Fee payment procedure

Free format text: PAYOR NUMBER ASSIGNED (ORIGINAL EVENT CODE: ASPN); ENTITY STATUS OF PATENT OWNER: LARGE ENTITY

CC Certificate of correction
FEPP Fee payment procedure

Free format text: PAYOR NUMBER ASSIGNED (ORIGINAL EVENT CODE: ASPN); ENTITY STATUS OF PATENT OWNER: LARGE ENTITY

Free format text: PAYER NUMBER DE-ASSIGNED (ORIGINAL EVENT CODE: RMPN); ENTITY STATUS OF PATENT OWNER: LARGE ENTITY

FPAY Fee payment

Year of fee payment: 4

REMI Maintenance fee reminder mailed
LAPS Lapse for failure to pay maintenance fees
STCH Information on status: patent discontinuation

Free format text: PATENT EXPIRED DUE TO NONPAYMENT OF MAINTENANCE FEES UNDER 37 CFR 1.362

FP Lapsed due to failure to pay maintenance fee

Effective date: 20090619