org.jikesrvm.adaptive.measurements.listeners
Class EdgeListener

java.lang.Object
  extended by org.jikesrvm.adaptive.measurements.listeners.Listener
      extended by org.jikesrvm.adaptive.measurements.listeners.ContextListener
          extended by org.jikesrvm.adaptive.measurements.listeners.EdgeListener
All Implemented Interfaces:
ArchitectureSpecific.StackframeLayoutConstants, StackframeLayoutConstants

public class EdgeListener
extends ContextListener
implements ArchitectureSpecific.StackframeLayoutConstants

A EdgeListener defines a listener that computes a call graph edge from the call stack. After a parameterized number of edges are collected, it notifies its organizer that the threshold is reached. Defines update's interface. EdgeListener communicates with an organizer through a integer array, buffer. Each time this listener is called, it places a triple of integers in buffer that correspond to the callee, caller, and machine code offset of the call site


Field Summary
private  int[] buffer
          buffer provides the communication channel between the listener and the organizer.
protected static boolean DEBUG
           
private  int desiredSamples
          Number of samples to be taken before issuing callback to controller
protected  int samplesTaken
          Number of samples taken so far
protected  int updateCalled
          Number of times update is called
 
Fields inherited from interface org.jikesrvm.ia32.StackframeLayoutConstants
BYTES_IN_STACKSLOT, FPU_STATE_SIZE, INVISIBLE_METHOD_ID, LOG_BYTES_IN_STACKSLOT, STACK_SIZE_BOOT, STACK_SIZE_COLLECTOR, STACK_SIZE_DLOPEN, STACK_SIZE_GCDISABLED, STACK_SIZE_GROW, STACK_SIZE_GUARD, STACK_SIZE_JNINATIVE_GROW, STACK_SIZE_MAX, STACK_SIZE_NORMAL, STACK_SIZE_SYSCALL, STACKFRAME_ALIGNMENT, STACKFRAME_BODY_OFFSET, STACKFRAME_FRAME_POINTER_OFFSET, STACKFRAME_HEADER_SIZE, STACKFRAME_METHOD_ID_OFFSET, STACKFRAME_RETURN_ADDRESS_OFFSET, STACKFRAME_SENTINEL_FP, XMM_STATE_SIZE
 
Constructor Summary
EdgeListener()
          Constructor
 
Method Summary
(package private)  int getTimesUpdateCalled()
           
 void report()
          report() noop
 void reset()
          Reset (in preparation of starting a new sampling window)
private  void resetBuffer()
          Reset the buffer
 void setBuffer(int[] buffer)
          Setup buffer and buffer size.
 void update(Address sfp, int whereFrom)
          This method is called when a call stack edge needs to be sampled.
 
Methods inherited from class org.jikesrvm.adaptive.measurements.listeners.Listener
activate, activateOrganizer, isActive, passivate, setOrganizer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

protected static final boolean DEBUG
See Also:
Constant Field Values

buffer

private int[] buffer
buffer provides the communication channel between the listener and the organizer. The buffer contains an array of triples where the caller and callee are CompiledMethodID's. Initially, buffer contains zeros. The listener adds triples. When the listener hits the end of the buffer, notify the organizer.


desiredSamples

private int desiredSamples
Number of samples to be taken before issuing callback to controller


samplesTaken

protected int samplesTaken
Number of samples taken so far


updateCalled

protected int updateCalled
Number of times update is called

Constructor Detail

EdgeListener

public EdgeListener()
Constructor

Method Detail

getTimesUpdateCalled

int getTimesUpdateCalled()
Returns:
the number of times that update has been called

setBuffer

public void setBuffer(int[] buffer)
Setup buffer and buffer size. This method must be called before any data can be written to the buffer.

Parameters:
buffer - the allocated buffer to contain the samples, size should be a muliple of 3

update

public final void update(Address sfp,
                         int whereFrom)
This method is called when a call stack edge needs to be sampled. Expect the sfp argument to point to the stack frame that contains the target of the edge to be sampled. NOTE: This method is uninterruptible, therefore we don't need to disable thread switching during stackframe inspection.

Specified by:
update in class ContextListener
Parameters:
sfp - a pointer to the stack frame that corresponds to the callee of the call graph edge that is to be sampled.
whereFrom - Was this a yieldpoint in a PROLOGUE, BACKEDGE, or EPILOGUE?

report

public final void report()
report() noop

Specified by:
report in class Listener

reset

public void reset()
Reset (in preparation of starting a new sampling window)

Specified by:
reset in class Listener

resetBuffer

private void resetBuffer()
Reset the buffer