org.jikesrvm.mm.mmtk.gcspy
Class ServerInterpreter

java.lang.Object
  extended by org.mmtk.vm.gcspy.ServerInterpreter
      extended by org.jikesrvm.mm.mmtk.gcspy.ServerInterpreter
All Implemented Interfaces:
JavaHeaderConstants, SizeConstants

public class ServerInterpreter
extends ServerInterpreter
implements JavaHeaderConstants

Generic GCspy Server Interpreter.

This class implements the GCspy server. The server runs as a separate pthread and communicates with GCspy clients. It handles commands from the client and passes data to it. Mostly it forwards calls to the C gcspy library.


Field Summary
 
Fields inherited from class org.mmtk.vm.gcspy.ServerInterpreter
DEBUG, initialised, MAX_LEN, MAX_SPACES, server, spaces
 
Fields inherited from interface org.jikesrvm.objectmodel.JavaHeaderConstants
ADDRESS_BASED_HASHING, ALIGNMENT_MASK, ALIGNMENT_VALUE, ALLOWS_LINEAR_SCAN, ARRAY_BASE_OFFSET, ARRAY_LENGTH_BYTES, ARRAY_LENGTH_OFFSET, DYNAMIC_HASH_OFFSET, FIELD_ZERO_OFFSET, FORWARDING_PTR_OVERLAYS_TIB, GC_HEADER_BYTES, GC_HEADER_OFFSET, HASH_STATE_HASHED, HASH_STATE_HASHED_AND_MOVED, HASH_STATE_MASK, HASH_STATE_UNHASHED, HASHCODE_BYTES, HASHCODE_OFFSET, JAVA_HEADER_BYTES, JAVA_HEADER_OFFSET, LOG_MIN_ALIGNMENT, MISC_HEADER_BYTES, MISC_HEADER_OFFSET, NUM_AVAILABLE_BITS, OTHER_HEADER_BYTES, SEGREGATE_ARRAYS_FOR_LINEAR_SCAN, STATUS_BYTES, TIB_BYTES
 
Fields inherited from interface org.jikesrvm.SizeConstants
BITS_IN_ADDRESS, BITS_IN_BOOLEAN, BITS_IN_BYTE, BITS_IN_CHAR, BITS_IN_DOUBLE, BITS_IN_EXTENT, BITS_IN_FLOAT, BITS_IN_INT, BITS_IN_LONG, BITS_IN_OFFSET, BITS_IN_PAGE, BITS_IN_SHORT, BITS_IN_WORD, BYTES_IN_ADDRESS, BYTES_IN_BOOLEAN, BYTES_IN_BYTE, BYTES_IN_CHAR, BYTES_IN_DOUBLE, BYTES_IN_EXTENT, BYTES_IN_FLOAT, BYTES_IN_INT, BYTES_IN_LONG, BYTES_IN_OFFSET, BYTES_IN_PAGE, BYTES_IN_SHORT, BYTES_IN_WORD, LOG_BITS_IN_ADDRESS, LOG_BITS_IN_BOOLEAN, LOG_BITS_IN_BYTE, LOG_BITS_IN_CHAR, LOG_BITS_IN_DOUBLE, LOG_BITS_IN_EXTENT, LOG_BITS_IN_FLOAT, LOG_BITS_IN_INT, LOG_BITS_IN_LONG, LOG_BITS_IN_OFFSET, LOG_BITS_IN_PAGE, LOG_BITS_IN_SHORT, LOG_BITS_IN_WORD, LOG_BYTES_IN_ADDRESS, LOG_BYTES_IN_BOOLEAN, LOG_BYTES_IN_BYTE, LOG_BYTES_IN_CHAR, LOG_BYTES_IN_DOUBLE, LOG_BYTES_IN_EXTENT, LOG_BYTES_IN_FLOAT, LOG_BYTES_IN_INT, LOG_BYTES_IN_LONG, LOG_BYTES_IN_OFFSET, LOG_BYTES_IN_PAGE, LOG_BYTES_IN_SHORT, LOG_BYTES_IN_WORD
 
Constructor Summary
ServerInterpreter()
           
 
Method Summary
 void addEvent(int num, String name)
          Add an event to the ServerInterpreter.
 int computeHeaderSize()
          Discover the smallest header size for objects.
 void init(String name, int port, boolean verbose)
          Create a new ServerInterpreter singleton.
 boolean isConnected(int event)
          Are we connected to a GCspy client?
 void serverSafepoint(int event)
          Indicate that we are at a server safe point (e.g. the end of a GC).
 void setGeneralInfo(String info)
          Set the general info for the ServerInterpreter.
 void startCompensationTimer()
          Start compensation timer so that time spent gathering data is not confused with the time spent in the application and the VM.
 void startServer(boolean wait)
          Start the server, running its main loop in a pthread.
 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 org.mmtk.vm.gcspy.ServerInterpreter
addSpace, getServerAddress
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerInterpreter

public ServerInterpreter()
Method Detail

init

public void init(String name,
                 int port,
                 boolean verbose)
Description copied from class: ServerInterpreter
Create a new ServerInterpreter singleton.

Specified by:
init in class ServerInterpreter
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 void addEvent(int num,
                     String name)
Description copied from class: ServerInterpreter
Add an event to the ServerInterpreter.

Specified by:
addEvent in class ServerInterpreter
Parameters:
num - the event number
name - the event name

setGeneralInfo

public void setGeneralInfo(String info)
Description copied from class: ServerInterpreter
Set the general info for the ServerInterpreter.

Specified by:
setGeneralInfo in class ServerInterpreter
Parameters:
info - the information

startServer

public void startServer(boolean wait)
Description copied from class: ServerInterpreter
Start the server, running its main loop in a pthread.

Specified by:
startServer in class ServerInterpreter
Parameters:
wait - Whether to wait for the client to connect

isConnected

public boolean isConnected(int event)
Description copied from class: ServerInterpreter
Are we connected to a GCspy client?

Specified by:
isConnected in class ServerInterpreter
Parameters:
event - The current event
Returns:
true if we are connected

startCompensationTimer

public void startCompensationTimer()
Description copied from class: ServerInterpreter
Start compensation timer so that time spent gathering data is not confused with the time spent in the application and the VM.

Specified by:
startCompensationTimer in class ServerInterpreter

stopCompensationTimer

public void stopCompensationTimer()
Description copied from class: ServerInterpreter
Stop compensation timer so that time spent gathering data is not confused with the time spent in the application and the VM.r

Specified by:
stopCompensationTimer in class ServerInterpreter

serverSafepoint

public void serverSafepoint(int event)
Description copied from class: ServerInterpreter
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.

Specified by:
serverSafepoint in class ServerInterpreter
Parameters:
event - The current event

computeHeaderSize

public int computeHeaderSize()
Description copied from class: ServerInterpreter
Discover the smallest header size for objects.

Specified by:
computeHeaderSize in class ServerInterpreter
Returns:
the size in bytes