org.mmtk.vm.gcspy
Class ServerInterpreter

java.lang.Object
  extended by org.mmtk.vm.gcspy.ServerInterpreter
Direct Known Subclasses:
ServerInterpreter

public abstract class ServerInterpreter
extends Object

Abstract class for the GCspy server interpreter

Implementing classes will mostly forward calls to the C gcspy library.


Field Summary
protected static boolean DEBUG
           
protected static boolean initialised
           
protected static int MAX_LEN
           
protected static int MAX_SPACES
           
protected  Address server
           
protected  ServerSpace[] spaces
           
 
Constructor Summary
ServerInterpreter()
           
 
Method Summary
abstract  void addEvent(int num, String name)
          Add an event to the ServerInterpreter.
 int addSpace(ServerSpace space)
          Add a GCspy ServerSpace to the ServerInterpreter.
abstract  int computeHeaderSize()
          Discover the smallest header size for objects.
 Address getServerAddress()
          Get a pointer to the C server, gcspy_main_server_t.
abstract  void init(String name, int port, boolean verbose)
          Create a new ServerInterpreter singleton.
abstract  boolean isConnected(int event)
          Are we connected to a GCspy client?
abstract  void serverSafepoint(int event)
          Indicate that we are at a server safe point (e.g. the end of a GC).
abstract  void setGeneralInfo(String info)
          Set the general info for the ServerInterpreter.
abstract  void startCompensationTimer()
          Start compensation timer so that time spent gathering data is not confused with the time spent in the application and the VM.
abstract  void startServer(boolean wait)
          Start the server, running its main loop in a pthread.
abstract  void stopCompensationTimer()
          Stop compensation timer so that time spent gathering data is not confused with the time spent in the application and the VM.r
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_LEN

protected static final int MAX_LEN
See Also:
Constant Field Values

MAX_SPACES

protected static final int MAX_SPACES
See Also:
Constant Field Values

initialised

protected static boolean initialised

spaces

protected ServerSpace[] spaces

server

protected Address server

DEBUG

protected static final boolean DEBUG
See Also:
Constant Field Values
Constructor Detail

ServerInterpreter

public ServerInterpreter()
Method Detail

init

public abstract void init(String name,
                          int port,
                          boolean verbose)
Create a new ServerInterpreter singleton.

Parameters:
name - The name of the server
port - The number of the port on which to communicate
verbose - Whether the server is to run verbosely

addEvent

public abstract void addEvent(int num,
                              String name)
Add an event to the ServerInterpreter.

Parameters:
num - the event number
name - the event name

setGeneralInfo

public abstract void setGeneralInfo(String info)
Set the general info for the ServerInterpreter.

Parameters:
info - the information

getServerAddress

public Address getServerAddress()
Get a pointer to the C server, gcspy_main_server_t. This address is used in all calls to the server in the C library.

Returns:
the address of the server

addSpace

public int addSpace(ServerSpace space)
Add a GCspy ServerSpace to the ServerInterpreter. This method returns a unique space ID for the ServerSpace (again used in calls to the C library).

Parameters:
space - the ServerSpace to add
Returns:
a unique id for this space
Throws:
IndexOutOfBoundsException - on attempt to add more than MAX_SPACES spaces

startServer

public abstract void startServer(boolean wait)
Start the server, running its main loop in a pthread.

Parameters:
wait - Whether to wait for the client to connect

isConnected

public abstract boolean isConnected(int event)
Are we connected to a GCspy client?

Parameters:
event - The current event
Returns:
true if we are connected

startCompensationTimer

public abstract void startCompensationTimer()
Start compensation timer so that time spent gathering data is not confused with the time spent in the application and the VM.


stopCompensationTimer

public abstract void stopCompensationTimer()
Stop compensation timer so that time spent gathering data is not confused with the time spent in the application and the VM.r


serverSafepoint

public abstract void serverSafepoint(int event)
Indicate that we are at a server safe point (e.g. the end of a GC). This is a point at which the server can pause, play one, etc.

Parameters:
event - The current event

computeHeaderSize

public abstract int computeHeaderSize()
Discover the smallest header size for objects.

Returns:
the size in bytes