org.jikesrvm.adaptive.measurements
Class RuntimeMeasurements

java.lang.Object
  extended by org.jikesrvm.adaptive.measurements.RuntimeMeasurements

public abstract class RuntimeMeasurements
extends Object

RuntimeMeasurements manages listeners, decayable objects, and reportable objects.

A listener is installed by an organizer, and activated at thread switch time by Thread. Depending on the update method that the listener supports, it can be either a method, context, or a null listener. Currently we have different registries for different listeners. An alternative design is to have one register with where entries are tagged.

A decayable object implements the Decayable interface. Anyone can register a decayable object, The DecayOrganizer periodically decays all objects that have been registers.

A reportable object implements the Reportable interface, and is typically registered and used by the instrumentation subsystem. A Reporable can be reset and reported.


Field Summary
private static ContextListener[] cbsContextListeners
          context listeners that trigger on CBS call yieldpoints
private static MethodListener[] cbsMethodListeners
          method listeners that trigger on CBS Method yieldpoints
(package private) static int decayEventCounter
          Counts the number of decay events
(package private) static Vector<Decayable> decayObjects
          The currently registered decayable objects
(package private) static Vector<Reportable> reportObjects
          The currently registered reportable objects
private static ContextListener[] timerContextListeners
          listeners on timer ticks for contexts
private static MethodListener[] timerMethodListeners
          listeners on timer ticks for methods
private static NullListener[] timerNullListeners
          listeners on timer ticks for nulls
 
Constructor Summary
RuntimeMeasurements()
           
 
Method Summary
static void boot()
          Called when the VM is booting
static void decayDecayableObjects()
          Decay all registered decayable objects.
static void installCBSContextListener(ContextListener s)
          Install a context listener on CBS ticks
static void installCBSMethodListener(MethodListener s)
          Install a method listener on CBS ticks
static void installTimerContextListener(ContextListener s)
          Install a context listener on timer ticks
static void installTimerMethodListener(MethodListener s)
          Install a method listener on timer ticks
static void installTimerNullListener(NullListener s)
          Install a null listener on timer ticks
static void registerDecayableObject(Decayable obj)
          Register an object that should be decayed.
static void registerReportableObject(Reportable obj)
          Register an object that wants to have its report method called whenever RuntimeMeasurements.report is called
static void report()
          Report the current state of runtime measurements
private static void reportReportableObjects()
          Report to all registered reportable objects
static void resetReportableObjects()
          Reset to all registered reportable objects
static void stop()
          Stop the runtime measurement subsystem
static void takeCBSCallSample(int whereFrom, Address yieldpointServiceMethodFP)
          Called from Thread.yieldpoint when it is time to take a CBS call sample.
static void takeCBSMethodSample(int whereFrom, Address yieldpointServiceMethodFP)
          Called from Thread.yieldpoint when it is time to take a CBS method sample.
static void takeTimerSample(int whereFrom, Address yieldpointServiceMethodFP)
          Called from Thread.yieldpoint every time it is invoked due to a timer interrupt.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

timerMethodListeners

private static MethodListener[] timerMethodListeners
listeners on timer ticks for methods


timerContextListeners

private static ContextListener[] timerContextListeners
listeners on timer ticks for contexts


timerNullListeners

private static NullListener[] timerNullListeners
listeners on timer ticks for nulls


cbsMethodListeners

private static MethodListener[] cbsMethodListeners
method listeners that trigger on CBS Method yieldpoints


cbsContextListeners

private static ContextListener[] cbsContextListeners
context listeners that trigger on CBS call yieldpoints


decayObjects

static Vector<Decayable> decayObjects
The currently registered decayable objects


decayEventCounter

static int decayEventCounter
Counts the number of decay events


reportObjects

static Vector<Reportable> reportObjects
The currently registered reportable objects

Constructor Detail

RuntimeMeasurements

public RuntimeMeasurements()
Method Detail

installTimerMethodListener

public static void installTimerMethodListener(MethodListener s)
Install a method listener on timer ticks

Parameters:
s - method listener to be installed

installTimerContextListener

public static void installTimerContextListener(ContextListener s)
Install a context listener on timer ticks

Parameters:
s - context listener to be installed

installTimerNullListener

public static void installTimerNullListener(NullListener s)
Install a null listener on timer ticks

Parameters:
s - null listener to be installed

takeTimerSample

public static void takeTimerSample(int whereFrom,
                                   Address yieldpointServiceMethodFP)
Called from Thread.yieldpoint every time it is invoked due to a timer interrupt.


installCBSMethodListener

public static void installCBSMethodListener(MethodListener s)
Install a method listener on CBS ticks

Parameters:
s - method listener to be installed

installCBSContextListener

public static void installCBSContextListener(ContextListener s)
Install a context listener on CBS ticks

Parameters:
s - context listener to be installed

takeCBSMethodSample

public static void takeCBSMethodSample(int whereFrom,
                                       Address yieldpointServiceMethodFP)
Called from Thread.yieldpoint when it is time to take a CBS method sample.


takeCBSCallSample

public static void takeCBSCallSample(int whereFrom,
                                     Address yieldpointServiceMethodFP)
Called from Thread.yieldpoint when it is time to take a CBS call sample.


registerDecayableObject

public static void registerDecayableObject(Decayable obj)
Register an object that should be decayed. The passed object will have its decay method called when the decaying thread decides it is time for the system to decay.


decayDecayableObjects

public static void decayDecayableObjects()
Decay all registered decayable objects.


registerReportableObject

public static void registerReportableObject(Reportable obj)
Register an object that wants to have its report method called whenever RuntimeMeasurements.report is called


resetReportableObjects

public static void resetReportableObjects()
Reset to all registered reportable objects


reportReportableObjects

private static void reportReportableObjects()
Report to all registered reportable objects


report

public static void report()
Report the current state of runtime measurements


stop

public static void stop()
Stop the runtime measurement subsystem


boot

public static void boot()
Called when the VM is booting