org.jikesrvm.adaptive.measurements.organizers
Class DynamicCallGraphOrganizer

java.lang.Object
  extended by org.jikesrvm.scheduler.SystemThread
      extended by org.jikesrvm.adaptive.measurements.organizers.Organizer
          extended by org.jikesrvm.adaptive.measurements.organizers.DynamicCallGraphOrganizer

public class DynamicCallGraphOrganizer
extends Organizer

An organizer to build a dynamic call graph from call graph edge samples.

It communicates with an edge listener through a integer array, denoted buffer. When this organizer is woken up via threshold reached, it processes the sequence of triples that are contained in buffer.

After processing the buffer and updating the dynamic call graph, it optionally notifies the AdaptiveInliningOrganizer who is responsible for analyzing the dynamic call graph for the purposes of feedback-directed inlining.

Note: Since this information is intended to drive feedback-directed inlining, the organizer drops edges that are not relevant. For example, one of the methods is a native method, or the callee is a runtime service routine and thus can't be inlined into its caller even if it is reported as hot. Thus, the call graph may not contain some hot edges since they aren't viable inlining candidates. One may argue that this is not the right design. Perhaps instead the edges should be present for profiling purposes, but not reported as inlining candidates to the

EXPECTATION: buffer is filled all the way up with triples.


Field Summary
private  int[] buffer
          buffer provides the communication channel between the edge listener and the organizer.
private  int bufferSize
          the buffer's size, i.e. length of buffer
private static boolean DEBUG
           
private  int numberOfBufferTriples
          the maximum number of triples contained in buffer
private  int thresholdReachedCount
          Countdown of times we have to have called thresholdReached before we believe the call graph has enough samples that it is reasonable to use it to guide profile-directed inlining.
 
Fields inherited from class org.jikesrvm.adaptive.measurements.organizers.Organizer
listener
 
Fields inherited from class org.jikesrvm.scheduler.SystemThread
rvmThread
 
Constructor Summary
DynamicCallGraphOrganizer(EdgeListener edgeListener)
          Constructs a new dynamic call graph organizer that will get its data from the given edge listener.
 
Method Summary
 void initialize()
          Initialization: set up data structures and sampling objects.
 boolean someDataAvailable()
          Checks if the dynamic call graph organizer has gathered and processed enough samples to support decisions.
(package private)  void thresholdReached()
          Process contents of buffer: add call graph edges and increment their weights.
 
Methods inherited from class org.jikesrvm.adaptive.measurements.organizers.Organizer
activate, report, run
 
Methods inherited from class org.jikesrvm.scheduler.SystemThread
getRVMThread, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values

buffer

private int[] buffer
buffer provides the communication channel between the edge listener and the organizer.

The buffer contains an array of triples <callee, caller, address> where the caller and callee are CompiledMethodID's, and address identifies the call site. The edge listener adds triples. At some point the listener deregisters itself and notifies the organizer by calling thresholdReached().


bufferSize

private int bufferSize
the buffer's size, i.e. length of buffer


numberOfBufferTriples

private int numberOfBufferTriples
the maximum number of triples contained in buffer


thresholdReachedCount

private int thresholdReachedCount
Countdown of times we have to have called thresholdReached before we believe the call graph has enough samples that it is reasonable to use it to guide profile-directed inlining. When this value reaches 0, we stop decrementing it and start letting other parts of the adaptive system use the profile data.

Constructor Detail

DynamicCallGraphOrganizer

public DynamicCallGraphOrganizer(EdgeListener edgeListener)
Constructs a new dynamic call graph organizer that will get its data from the given edge listener.

Parameters:
edgeListener - the listener that provides data for this organizer
Method Detail

initialize

public void initialize()
Initialization: set up data structures and sampling objects.

Uses either timer based sampling or counter based sampling, depending on Controller.options.

Specified by:
initialize in class Organizer

thresholdReached

void thresholdReached()
Process contents of buffer: add call graph edges and increment their weights.

Specified by:
thresholdReached in class Organizer

someDataAvailable

public boolean someDataAvailable()
Checks if the dynamic call graph organizer has gathered and processed enough samples to support decisions.

Returns:
true if enough data is available, false otherwise