Message-ID: <98572399.86058.1397708469169.JavaMail.email@example.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_86057_2129345722.1397708469169" ------=_Part_86057_2129345722.1397708469169 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
GCspy is a visualisation framework that allows developers to observe the= behaviour of the heap and related data structures. For details of the GCsp= y model, see GCspy: An adaptable heap visualisation fram= eworkby Tony Printezis and Richard Jones, OOPSLA'02. The framework comp= rises two components that communicate across a socket: a client an= d a serverincorporated into the virtual machine of the system bein= g visualised. The client is usually a visualiser (written in Java) but the = framework also provides other tools (for example, to store traces in a comp= ressed file). The GCspy server implementation for JikesRVM was contributed = by Richard Jones of the University of Kent.=20
GCspy is designed to be independent of the target system. Instead, it re= quires the GC developer to describe their system in terms of four GCspy abs= tractions, spaces, streams, tiles and events. This descri= ption is transmitted to the visualiser when it connects to the server.= =20
A space is an abstraction of a component of the system; it may = represent a memory region, a free-list, a remembered-set or whatever. Each = space is divided into a number of blocks which are represented by the visua= liser as tiles. Each space will have a number of attributes -- streams -- such as the amount of space used, the number of objects it= contains, the length of a free-list and so on.=20
In order to instrument a Jikes RVM collector with GCspy:=20
startGCspyServermethod in that collector's plan= . That method initialises the GCspy server with the port on which to commun= icate and a list of event names, instantiates drivers for each space, and t= hen starts the server.
Space drivers handle communication between collectors and the G= Cspy infrastructure by mapping information collected by the memory manager = to the space's streams. A typical space driver will:=20
The Jikes RVM SSGCspy plan gives an example of how to instrument a colle= ctor. It provides GCspy spaces, streams and drivers for the semi-spaces, th= e immortal space and the large object space, and also illustrates how perfo= rmance may be traded for the gathering of more detailed information.=20
The GCspy C server code needs a pthread (created in
sys.C) in order to run. So, GCspy will only wor=
k on a system where you've build Jikes RVM with
.processor set to
0. The build process will fail if you=
try to configure such a build.
The GCspy client code makes use of the Java Advanced Imaging (JAI) API. =
The build system will attempt to download and install the JAI component whe=
n required but this is only supported on the
rm. The build system will also attempt to download and install the GCSpy se=
rver when required.
To build the Jikes RVM with GCSpy support the configuration parameter
1 such as in th=
BaseBaseSemiSpaceGCspyconfiguration. You can also have the J=
ikes RVM build process create a script to start the GCSpy client tool if GC=
Spy was built with support for client component. To achieve this the config=
config.include.gcspy-client must be set to <=
The following steps build the Jikes RVM with support for GCSpy on linux-=
$ cd $RVM_ROOT
$ ant -Dhost.n=
ame=3Dia32-linux -Dconfig.name=3DBaseBaseSemiSpaceGCspy -Dconfig.include.gc=
It is also possible to build the Jikes RVM with GCSpy support but link i=
t against a fake stub implementation rather than the real GCSpy implementat=
ion. This is achieved by setting the configuration parameter
1. This is used in the nightly tes=
To start Jikes RVM with GCSpy enabled you need to specify the port the G=
CSpy server will listen on.
$ cd $RVM_ROOT/dist/BaseBaseSemiSpa=
$ ./rvm -Xms20m -X:gc:gcspyPort=3D300=
0 -X:gc:gcspyWait=3Dtrue &
Then you need to start the GCspy visualiser client.
$ cd $RV=
After this you can specify the port and host to connect to (i.e. localho= st:3000) and click the "Connect" button in the bottom right-hand = corner of the visualiser.=20
Additional GCspy-related arguments to the
0, which signifies no connection.
To instrument a new collector with GCspy, you will probably want to subc=
lass your collector and to write new drivers for it. The following sections=
explain the modifications you need to make and how to write a driver. You =
org.mmtk.plan.semispace.gcspy and its drivers as an ex=
The recommended way to instrument a Jikes RVM collector with GCspy is to=
gcspy subdirectory in the directory of the collector=
being instrumented, e.g.
MMTk/src/org/mmtk/plan/semispace/gcspy. In that directory, we need 5 classes:
SSGCspy is the plan for the instrumented collector. It is a=
SSConstraints to pr=
boolean needsLinearScan() and
Cspy(), both of which return true.
SSTraceLocal to over=
willNotMoveto ensure =
that tracing deals properly with GCspy objects: the GCspyTraceLocal file wi=
ll be similar for any instrumented collector.
The instrumented collector,
SSCollector. It needs to override
d must also override its parent's methods
collectionPhase, to a=
llow the allocators to collect data; and its
ostAlloc methods to allocate GCspy objects in GCspy's heap space.
SSGCspy.startGCspyServer is called immediately before the &=
quot;main" method is loaded and run. It initialises the GCspy server w=
ith the port on which to communicate, adds event names, instantiates a driv=
er for each space, and then starts the server, forcing the VM to wait for a=
GCspy to connect if necessary. This method has the following responsibilit=
ServerInterpreter(`server' for shor= t) server.addEvent(eventID, eventName);
AbstractDriver and register their space with=
ServerInterpreter. In addition to the server, drivers wil=
l take as arguments the name of the space, the MMTk space, the tilesize, an=
d whether this space is to be the main space in the visualiser.
Instrumenters will typically want to add data collection points before, =
during and after a collection by overriding
SSGCspyCollector deals with the data in the semi-spaces tha=
t has been allocated there (copied) by the collector. It only does any real=
work at the end of the collector's last tracing phase,
SSGCspyMutator is more complex: as well as gathering data f=
or objects that it allocated in From-space at the start of the
E_MUTATOR phase, it also deals with the immortal and large object sp=
At a collection point, the collector or mutator will typically=20
SSGCspyCollectordoes not call the GCspy server's=
serverSafepointmethod, as the collector phase is usually fol= lowed by a mutator phase. Instead,
serverSafepointcan be call= ed by
SSGCspyMutatorto indicate that this is a point at which= the server can pause, play one event, etc.
Gathering data will vary from MMTk space to space. It will typically be = necessary to resize a space before gathering data. For a space,=20
setRangemethod. The dr= iver should then iterate through its MMTk space, passing a reference to eac= h object found to the driver's scan method.
GCspy space drivers extend Some drivers may also create a The chief roles of a driver are to accumulate tile statistics, and to tr=
ansmit the summary and control data and the data for all of their streams. =
Their data gathering interface is the When the collector or mutator has finished gathering data, it calls the =
Note that =20
AbstractDriver. This class creat=
es a new GCspy
ServerSpace and initializes the control values =
for each tile in the space. Control values indicate whether a tile=
is used, unused, a background, a separator<=
/em> or a link. The constructor for a typical space driver will:=
Stream for each attribute of a space.
LinearScan object to handle =
call-backs from the VM as it sweeps the heap (see above).
scan method (to which an=
object reference or address is passed).
transmit of the driver for each space that needs to send its d=
ata. Streams may send values of types byte, short or int, implemented throu=
ream. A driver's
transmit method will typically:
ONTROL_USED, start, numBlocks);
USED, end, remainingBlocks);
AbstractDriver.send takes care of sending the inf=
ormation for all streams (including control data).
Subspace provides a useful abstraction of a contiguous regi=
on of a heap, recording its start and end address, the index of its first b=
lock, the size of blocks in this space and the number of blocks in the regi=
on. In particular,
Subspace provides methods to:
Some drivers may also create a
The chief roles of a driver are to accumulate tile statistics, and to tr=
ansmit the summary and control data and the data for all of their streams. =
Their data gathering interface is the
When the collector or mutator has finished gathering data, it calls the =