org.jikesrvm.tuningfork
Class Feedlet

java.lang.Object
  extended by org.jikesrvm.tuningfork.Feedlet

public final class Feedlet
extends Object

A Feedlet is a entity that is a unit of trace generation for TuningFork. In Jikes RVM, a Feedlet is typically associated with a VM_Thread.

Note an important assumption that a Feedlet will only be used by a single thread at a time. All operations are unsynchronized. This invariant is usually met because only the VM_Thread to which it is attached is allowed to perform addEvent operations on the Feedlet. If a Feedlet is attached to something other than a VM_Thread, then this invariant must be established via external synchronization.


Field Summary
private static boolean CHECK_TYPES
           
(package private)  boolean enabled
          Enabled is true when TF engine is enabled, false otherwise.
private  TraceEngine engine
           
private  EventChunk events
           
private  int feedletIndex
           
private  int sequenceNumber
           
 
Constructor Summary
Feedlet(TraceEngine engine, int feedletIndex)
          Create a new Feedlet.
 
Method Summary
private  boolean acquireEventChunk()
           
 void addEvent(EventType et)
          Add an event to the feedlet's generated event stream
 void addEvent(EventType et, double dval1)
          Add an event to the feedlet's generated event stream
 void addEvent(EventType et, double dval1, String sval1)
          Add an event to the feedlet's generated event stream
 void addEvent(EventType et, int ival1)
          Add an event to the feedlet's generated event stream
 void addEvent(EventType et, int[] idata, long[] ldata, double[] ddata, String[] sdata)
          Add an event to the feedlet's generated event stream
 void addEvent(EventType et, int ival1, double dval1)
          Add an event to the feedlet's generated event stream
 void addEvent(EventType et, int ival1, int ival2)
          Add an event to the feedlet's generated event stream
 void addEvent(EventType et, int ival1, int ival2, double dval1)
          Add an event to the feedlet's generated event stream
 void addEvent(EventType et, int ival1, int ival2, int ival3)
          Add an event to the feedlet's generated event stream
 void addEvent(EventType et, int ival1, int ival2, int ival3, int ival4)
          Add an event to the feedlet's generated event stream
 void addEvent(EventType et, long lval1)
          Add an event to the feedlet's generated event stream
 void addEvent(EventType et, String sval1)
          Add an event to the feedlet's generated event stream
private  void addEventInternal(EventType et)
           
private  void addEventInternal(EventType et, double dval1)
           
private  void addEventInternal(EventType et, double dval1, String sval1)
           
private  void addEventInternal(EventType et, int ival1)
           
private  void addEventInternal(EventType et, int[] idata, long[] ldata, double[] ddata, String[] sdata)
           
private  void addEventInternal(EventType et, int ival1, double dval1)
           
private  void addEventInternal(EventType et, int ival1, int ival2)
           
private  void addEventInternal(EventType et, int ival1, int ival2, double dval1)
           
private  void addEventInternal(EventType et, int ival1, int ival2, int ival3)
           
private  void addEventInternal(EventType et, int ival1, int ival2, int ival3, int ival4)
           
private  void addEventInternal(EventType et, long lval1)
           
private  void addEventInternal(EventType et, String sval1)
           
private  boolean checkTypes(EventType et, int numInts, int numLongs, int numDoubles, int numStrings)
           
private  void flushEventChunk()
           
(package private)  int getFeedletIndex()
           
private  long getTimeStamp()
           
(package private)  void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHECK_TYPES

private static final boolean CHECK_TYPES
See Also:
Constant Field Values

engine

private final TraceEngine engine

feedletIndex

private final int feedletIndex

sequenceNumber

private int sequenceNumber

events

private EventChunk events

enabled

boolean enabled
Enabled is true when TF engine is enabled, false otherwise. This field is intentionally not made final to (1) allow us to disable the boot thread's feedlet during VM booting (2) allow us to dynamically enable/disable event generation (for eventual socket hookup) (3) allow us to turn off event generation during VM shutdown

Constructor Detail

Feedlet

Feedlet(TraceEngine engine,
        int feedletIndex)
Create a new Feedlet. This method is only meant to be called from TraceEngine.

Parameters:
engine - the TraceEngine instance to which this feedlet is attached.
feedletIndex - the index to use for the Feedlet
Method Detail

getFeedletIndex

int getFeedletIndex()
Returns:
the feedlet's index

shutdown

void shutdown()

addEvent

public void addEvent(EventType et)
Add an event to the feedlet's generated event stream

Parameters:
et - The type of event to add

addEventInternal

private void addEventInternal(EventType et)

addEvent

public void addEvent(EventType et,
                     int ival1)
Add an event to the feedlet's generated event stream

Parameters:
et - The type of event to add
ival1 - The first int data value

addEventInternal

private void addEventInternal(EventType et,
                              int ival1)

addEvent

public void addEvent(EventType et,
                     int ival1,
                     int ival2)
Add an event to the feedlet's generated event stream

Parameters:
et - The type of event to add
ival1 - The first int data value
ival2 - The second int data value

addEventInternal

private void addEventInternal(EventType et,
                              int ival1,
                              int ival2)

addEvent

public void addEvent(EventType et,
                     int ival1,
                     int ival2,
                     int ival3)
Add an event to the feedlet's generated event stream

Parameters:
et - The type of event to add
ival1 - The first int data value
ival2 - The second int data value
ival3 - The third int data value

addEventInternal

private void addEventInternal(EventType et,
                              int ival1,
                              int ival2,
                              int ival3)

addEvent

public void addEvent(EventType et,
                     int ival1,
                     int ival2,
                     int ival3,
                     int ival4)
Add an event to the feedlet's generated event stream

Parameters:
et - The type of event to add
ival1 - The first int data value
ival2 - The second int data value
ival3 - The third int data value
ival4 - The fourth int data value

addEventInternal

private void addEventInternal(EventType et,
                              int ival1,
                              int ival2,
                              int ival3,
                              int ival4)

addEvent

public void addEvent(EventType et,
                     long lval1)
Add an event to the feedlet's generated event stream

Parameters:
et - The type of event to add
lval1 - The first double data value

addEventInternal

private void addEventInternal(EventType et,
                              long lval1)

addEvent

public void addEvent(EventType et,
                     double dval1)
Add an event to the feedlet's generated event stream

Parameters:
et - The type of event to add
dval1 - The first double data value

addEventInternal

private void addEventInternal(EventType et,
                              double dval1)

addEvent

public void addEvent(EventType et,
                     String sval1)
Add an event to the feedlet's generated event stream

Parameters:
et - The type of event to add
sval1 - The first String data value

addEventInternal

private void addEventInternal(EventType et,
                              String sval1)

addEvent

public void addEvent(EventType et,
                     int ival1,
                     double dval1)
Add an event to the feedlet's generated event stream

Parameters:
et - The type of event to add
ival1 - The first int data value
dval1 - The first double data value

addEventInternal

private void addEventInternal(EventType et,
                              int ival1,
                              double dval1)

addEvent

public void addEvent(EventType et,
                     int ival1,
                     int ival2,
                     double dval1)
Add an event to the feedlet's generated event stream

Parameters:
et - The type of event to add
ival1 - The first int data value
ival2 - The second int data value
dval1 - The first double data value

addEventInternal

private void addEventInternal(EventType et,
                              int ival1,
                              int ival2,
                              double dval1)

addEvent

public void addEvent(EventType et,
                     double dval1,
                     String sval1)
Add an event to the feedlet's generated event stream

Parameters:
et - The type of event to add
dval1 - The first double data value
sval1 - The first String data value

addEventInternal

private void addEventInternal(EventType et,
                              double dval1,
                              String sval1)

addEvent

public void addEvent(EventType et,
                     int[] idata,
                     long[] ldata,
                     double[] ddata,
                     String[] sdata)
Add an event to the feedlet's generated event stream

Parameters:
et -
idata - an array of int data values (may be null if no such values for this event)
ldata - an array of long data values (may be null if no such values for this event)
ddata - an array of double data values (may be null if no such values for this event)
sdata - an array of String data values (may be null if no such values for this event)

addEventInternal

private void addEventInternal(EventType et,
                              int[] idata,
                              long[] ldata,
                              double[] ddata,
                              String[] sdata)

checkTypes

private boolean checkTypes(EventType et,
                           int numInts,
                           int numLongs,
                           int numDoubles,
                           int numStrings)

getTimeStamp

private long getTimeStamp()

acquireEventChunk

private boolean acquireEventChunk()

flushEventChunk

private void flushEventChunk()