org.jikesrvm.adaptive.util
Class AOSLogging

java.lang.Object
  extended by org.jikesrvm.adaptive.util.AOSLogging

public final class AOSLogging
extends Object

This class provides logging functionality for the Adaptive Optimization System.

Right now this is fairly primitive, an evolving number of events are defined and log entries are quite unsophisticated.

Some obvious TODO items:

NOTE: All code that writes to the log is synchronized on the PrintStream object to avoid interspersed messages, which can happen when the compilation thread and the controller thread try to log a message "at the same time".

The current logging levels are:


Field Summary
private  boolean booted
           
private  PrintStream log
           
static AOSLogging logger
          Singleton instance of the logger
 
Constructor Summary
AOSLogging()
           
 
Method Summary
 void boot()
          Called from ControllerThread.run to initialize the logging subsystem
 boolean booted()
          Return whether AOS logging has booted.
 void compileAllMethodsCompleted()
           
 void controllerNotifiedForHotness(CompiledMethod hotMethod, double numSamples)
          This method logs that the controller is notified of a candidate to be recompiled due to hotness; i.e., the method has been inserted in the controller queue.
 void debug(String s)
           
 void decayingCounters()
          This method logs when the decay organizer runs.
 void decayStatistics(int decayCount)
          Call this method to dump statistics related to decaying
 PrintStream getLog()
          Returns the log object
private  String getTime()
          Helper routine to produce the current time as a string
 void logOsrEvent(String s)
           
 void oldVersionStillHot(HotMethodEvent hme)
          this method logs the event when the controller discovers a method that has been recompiled and the previous version is still regarded as hot, i.e., still on the stack and significant.
 void onStackReplacementAborted(CompilationPlan plan)
           
 void onStackReplacementCompleted(CompilationPlan plan)
           
 void onStackReplacementStarted(CompilationPlan plan)
           
 void organizerThresholdReached()
          This Method logs when the organizer thread has reached its sampling threshold
 void printControllerStats()
          Dumps lots of controller statistics to the log file
 void recompilationAborted(CompilationPlan plan)
          This method logs the abortion of an adaptively selected recompilation
 void recompilationCompleted(CompilationPlan plan)
          This method logs the successful completion of an adaptively selected recompilation
 void recompilationScheduled(CompilationPlan plan, double priority)
          This method logs the scheduling of a recompilation, i.e., it being inserted in the compilation queue.
 void recompilationStarted(CompilationPlan plan)
          This method logs the beginning of an adaptively selected recompilation
 void recompilingAllDynamicallyLoadedMethods()
          Call this method when one run of the application begins
 void recordCompileTime(CompiledMethod cm, double expectedCompilationTime)
          This method logs the actual compilation time for the given compiled method.
 void recordControllerEstimateCostDoNothing(RVMMethod method, int optLevel, double cost)
          This method logs a controller cost estimate for doing nothing.
 void recordControllerEstimateCostOpt(RVMMethod method, String choiceDesc, double compilationTime, double futureTime)
          This method logs a controller cost estimate.
 void recordOSRRecompilationDecision(ControllerPlan plan)
          This method logs the successful completion of an adaptively selected recompilation
 void recordUpdatedCompilationRates(byte compiler, RVMMethod method, int BCLength, int totalBCLength, int MCLength, int totalMCLength, double compTime, double totalCompTime, double totalLogOfRates, int totalLogValueMethods, int totalMethods)
          Records lots of details about the online computation of a compilation rate
 void reportBenefitRatio(int compiler1, int compiler2, double rate)
          This method reports the benefit ratio from one compiler to the other
 void reportCompilationRate(int compiler, double rate)
          This method reports the basic compilation rate for a compiler
 void reportCompileTimeRatio(int compiler1, int compiler2, double rate)
          This method reports the compile time ratio from one compiler to the other
 void reportSpeedupRate(int compiler, double rate)
          This method reports the basic speedup rate for a compiler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static final AOSLogging logger
Singleton instance of the logger


log

private PrintStream log

booted

private boolean booted
Constructor Detail

AOSLogging

public AOSLogging()
Method Detail

getLog

public PrintStream getLog()
Returns the log object


booted

public boolean booted()
Return whether AOS logging has booted.

Returns:
whether AOS logging has booted

getTime

private String getTime()
Helper routine to produce the current time as a string


boot

public void boot()
Called from ControllerThread.run to initialize the logging subsystem


decayStatistics

public void decayStatistics(int decayCount)
Call this method to dump statistics related to decaying

Parameters:
decayCount - the number of decay events

recompilingAllDynamicallyLoadedMethods

public void recompilingAllDynamicallyLoadedMethods()
Call this method when one run of the application begins


printControllerStats

public void printControllerStats()
Dumps lots of controller statistics to the log file


reportSpeedupRate

public void reportSpeedupRate(int compiler,
                              double rate)
This method reports the basic speedup rate for a compiler

Parameters:
compiler - the compiler you are reporting about
rate - the speedup rate

reportCompilationRate

public void reportCompilationRate(int compiler,
                                  double rate)
This method reports the basic compilation rate for a compiler

Parameters:
compiler - the compiler you are reporting about
rate - the compilation rate (bytecodes per millisecond)

reportBenefitRatio

public void reportBenefitRatio(int compiler1,
                               int compiler2,
                               double rate)
This method reports the benefit ratio from one compiler to the other

Parameters:
compiler1 - the first compiler
compiler2 - the second compiler
rate - the improvement from going from a compiler1-compiled method to a compiler2-compiled method

reportCompileTimeRatio

public void reportCompileTimeRatio(int compiler1,
                                   int compiler2,
                                   double rate)
This method reports the compile time ratio from one compiler to the other

Parameters:
compiler1 - the first compiler
compiler2 - the second compiler
rate - the ratio of compiler1 compilation rate to compiler2 compilation rate

recompilationScheduled

public void recompilationScheduled(CompilationPlan plan,
                                   double priority)
This method logs the scheduling of a recompilation, i.e., it being inserted in the compilation queue.

Parameters:
plan - the Compilation plan being executed.
priority - a number from 0.0 to 1.0 encoding the plan's priority.

recompilationStarted

public void recompilationStarted(CompilationPlan plan)
This method logs the beginning of an adaptively selected recompilation

Parameters:
plan - the Compilation plan being executed.

recompilationCompleted

public void recompilationCompleted(CompilationPlan plan)
This method logs the successful completion of an adaptively selected recompilation

Parameters:
plan - the Compilation plan being executed.

recompilationAborted

public void recompilationAborted(CompilationPlan plan)
This method logs the abortion of an adaptively selected recompilation

Parameters:
plan - the Compilation plan being executed.

recordCompileTime

public void recordCompileTime(CompiledMethod cm,
                              double expectedCompilationTime)
This method logs the actual compilation time for the given compiled method.

Parameters:
cm - the compiled method
expectedCompilationTime - the model-derived expected compilation time

oldVersionStillHot

public void oldVersionStillHot(HotMethodEvent hme)
this method logs the event when the controller discovers a method that has been recompiled and the previous version is still regarded as hot, i.e., still on the stack and significant.


decayingCounters

public void decayingCounters()
This method logs when the decay organizer runs.


organizerThresholdReached

public void organizerThresholdReached()
This Method logs when the organizer thread has reached its sampling threshold


controllerNotifiedForHotness

public void controllerNotifiedForHotness(CompiledMethod hotMethod,
                                         double numSamples)
This method logs that the controller is notified of a candidate to be recompiled due to hotness; i.e., the method has been inserted in the controller queue.

Parameters:
hotMethod - method to be recompiled, and
numSamples - number of samples attributed to the method

recordControllerEstimateCostDoNothing

public void recordControllerEstimateCostDoNothing(RVMMethod method,
                                                  int optLevel,
                                                  double cost)
This method logs a controller cost estimate for doing nothing.

Parameters:
method - the method of interest
optLevel - the opt level being estimated, -1 = baseline
cost - the computed cost for this method and level

recordControllerEstimateCostOpt

public void recordControllerEstimateCostOpt(RVMMethod method,
                                            String choiceDesc,
                                            double compilationTime,
                                            double futureTime)
This method logs a controller cost estimate.

Parameters:
method - the method of interest
choiceDesc - a String describing the choice point
compilationTime - the computed compilation cost for this method and level
futureTime - the computed future time, including cost and execution

recordUpdatedCompilationRates

public void recordUpdatedCompilationRates(byte compiler,
                                          RVMMethod method,
                                          int BCLength,
                                          int totalBCLength,
                                          int MCLength,
                                          int totalMCLength,
                                          double compTime,
                                          double totalCompTime,
                                          double totalLogOfRates,
                                          int totalLogValueMethods,
                                          int totalMethods)
Records lots of details about the online computation of a compilation rate

Parameters:
compiler - compiler of interest
method - the method
BCLength - the number of bytecodes
totalBCLength - cumulative number of bytecodes
MCLength - size of machine code
totalMCLength - cumulative size of machine code
compTime - compilation time for this method
totalCompTime - cumulative compilation time for this method
totalLogOfRates - running sum of the natural logs of the rates
totalLogValueMethods - number of methods used in the log of rates
totalMethods - total number of methods

compileAllMethodsCompleted

public void compileAllMethodsCompleted()

recordOSRRecompilationDecision

public void recordOSRRecompilationDecision(ControllerPlan plan)
This method logs the successful completion of an adaptively selected recompilation

Parameters:
plan - the Compilation plan being executed.

onStackReplacementStarted

public void onStackReplacementStarted(CompilationPlan plan)

onStackReplacementCompleted

public void onStackReplacementCompleted(CompilationPlan plan)

onStackReplacementAborted

public void onStackReplacementAborted(CompilationPlan plan)

logOsrEvent

public void logOsrEvent(String s)

debug

public void debug(String s)