Upload
sivanantham-s
View
11
Download
2
Embed Size (px)
Citation preview
PROFILING
THE ROLE OF PROFILINGTYPES OF PROFILE COLLECTING PROFILES PROFILING DURING INTERPRETATIONPROFILING TRANSLATED CODE PROFILING OVERHEAD
1. THE ROLE OF PROFILINGProfiling is the process of collecting instruction and data statistics for an executing program
This profile can be used as input to the code optimization
A Short code sequence called probes that records execution information into a profile log, is inserted by the compiler
Compiler uses the information in the profile log to generate optimized code
Probes may be optimally placed based on the program structure
In Dynamic optimization, the program structure is not known
Due to the dynamic nature, probes cannot be set early and profiling becomes more predictive
Optimization decisions should be made based on information from a partial execution of the program
2. TYPES OF PROFILE
There are several types of profile used in VMs
The First type indicates how frequently different code regions are being executed
The Second type is based on control flow predictability
The Third type is helpful in specific optimization i.e., profile about program variables holding same value most of the time
The first and second type of profile are implemented as Node profile and Edge profile respectively
3. COLLECTING PROFILESThere are two ways of collecting a profile, i) Instrumentation based profiling It targets specific program related events and counts all instances of the events being profiled Instrumentation can be divided into
•Hardware Instrumentation•Software Instrumentation
ii) Sampling based profiling In this method, at fixed or random interval the program is interrupted and an instance of a program related event is captured Various samples are made at various intervalsA statistical profile is made ready from the samplesDifferent types of counters may be used in sampling
4. PROFILING DURING INTERPRETATION When profiling during interpretation, the source instruction is accessed as data and the interpreter routines are the code that is being executed
Profiling code must also be added to interpreter routines
To perform basic block profiling during interpretation, profiling code must be added to all control transfer statements (branch and jump) because it begins a new basic block
To perform edge profiling, the same control transfer statements can be profiled but both the PC of the control transfer statements and the target are used to define a specific edge
The Profile data is kept in a table that is accessed via a source PC values of control transfer statements
Disadvantage: Profile Counter Decaying
5. PROFILING TRANSLATED CODE When profiling a translated code, each instruction can have its own custom profile
code Profile counters can be directly assigned to translated instructions selectively No requirement of Hashing function and Hash value Profile counters can be maintained in a form of an array
6. PROFILING OVERHEADIn general for accessing hash table we will require at least one load and store operationFor incrementing profile counters two memory accesses and add operation is requiredProfiling during interpretation increases the overhead by 10-20%Apart from performance overhead profiling leads to memory overhead for maintaining tables
THANK YOU