sscli workshop, redmond 19 september 2005 richard jones, hanspeter johner, marion sébastien...

22
SSCLI workshop, Redmond 19 September 2005 Richard Jones, Hanspeter Johner, Marion Sébastien University of Kent [email protected] c.uk [email protected] GCspy for Rotor

Upload: natalie-dillon

Post on 27-Mar-2015

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SSCLI workshop, Redmond 19 September 2005 Richard Jones, Hanspeter Johner, Marion Sébastien University of Kent R.E.Jones@kent.ac.uk sm244@kent.ac.uk GCspy

SSCLI workshop, Redmond19 September 2005

Richard Jones, Hanspeter Johner,Marion Sébastien

University of [email protected]@kent.ac.uk

GCspyforRotor

Page 2: SSCLI workshop, Redmond 19 September 2005 Richard Jones, Hanspeter Johner, Marion Sébastien University of Kent R.E.Jones@kent.ac.uk sm244@kent.ac.uk GCspy

SSCLI workshop, Redmond19 September 2005 2

GCspy Heap Visualisation Framework

1. Motivation & requirements

2. Abstractions & Architecture

3. Benefits

4. Rotor implementation

5. New views

6. Conclusion

Developed by Richard Jones and Tony Printezis

Page 3: SSCLI workshop, Redmond 19 September 2005 Richard Jones, Hanspeter Johner, Marion Sébastien University of Kent R.E.Jones@kent.ac.uk sm244@kent.ac.uk GCspy

SSCLI workshop, Redmond19 September 2005 3

Motivation

GCs have (almost) chaotic behaviour!

Visualisation allows• concise insight into GC’s behaviour• profiling / debugging

Avoid collecting / analysing very large traces• “a picture is worth a thousand awk invocations!”

T.Printezis

Page 4: SSCLI workshop, Redmond 19 September 2005 Richard Jones, Hanspeter Johner, Marion Sébastien University of Kent R.E.Jones@kent.ac.uk sm244@kent.ac.uk GCspy

SSCLI workshop, Redmond19 September 2005 4

Requirements

1. Portability

2. Adaptability

3. Extensibility

4. Scalability

5. Responsiveness

Page 5: SSCLI workshop, Redmond 19 September 2005 Richard Jones, Hanspeter Johner, Marion Sébastien University of Kent R.E.Jones@kent.ac.uk sm244@kent.ac.uk GCspy

SSCLI workshop, Redmond19 September 2005 5

Abstractions

EventEvent

e.g. start mark phase

StreamAttribute

e.g. used space

TileBlock

e.g. memory block

SpaceComponent

e.g. generation

VisualiserGC

Page 6: SSCLI workshop, Redmond 19 September 2005 Richard Jones, Hanspeter Johner, Marion Sébastien University of Kent R.E.Jones@kent.ac.uk sm244@kent.ac.uk GCspy

SSCLI workshop, Redmond19 September 2005 MSR Rotor Presentation Day 6

Architecture

GC/VM dependentGCspy generic

Virtual Machine

Application

Socket

Communications

Event filters

UsedRoots

ObjectsCardsMarked

Copy Driver MS Driver

Server-Interpreter

Copy GC MS GC

Data collection Init

Visualiser

Communications

Event filters

ControlStream 0Stream 1

Space 0 Space 1

Client-Interpreter

SpaceRenderer 0

SpaceRenderer 1

ControlStream 0Stream 1Stream 2

Page 7: SSCLI workshop, Redmond 19 September 2005 Richard Jones, Hanspeter Johner, Marion Sébastien University of Kent R.E.Jones@kent.ac.uk sm244@kent.ac.uk GCspy

SSCLI workshop, Redmond19 September 2005 7

GCspyTile Information

8 Streams

Magnifier

6 Spaces

History view of the Mature M-S space

Histogram view of the Mature space’s free-lists

Appel-style Nursery space- separators show history

View selectors

Event

Page 8: SSCLI workshop, Redmond 19 September 2005 Richard Jones, Hanspeter Johner, Marion Sébastien University of Kent R.E.Jones@kent.ac.uk sm244@kent.ac.uk GCspy

SSCLI workshop, Redmond19 September 2005

CLR Profiler

• Available since 2003 for the .NET platform

• Strengths:• Intended for the application developer

• Detailed exploration of the application’s memory behaviour

• Different views

• Weaknesses:• Slows down program’s execution from 10 to 100 times

• Huge log file (can consume gigabytes of space)

• Needs the application to be compiled in debug mode

• Not portable (only for .NET on windows)

Page 9: SSCLI workshop, Redmond 19 September 2005 Richard Jones, Hanspeter Johner, Marion Sébastien University of Kent R.E.Jones@kent.ac.uk sm244@kent.ac.uk GCspy

SSCLI workshop, Redmond19 September 2005 9

GCspy Benefits

• Loosely coupled to VM rapid development of visualisation of new algorithms.

• Visualise a variety of data structures (card-tables, free-lists, trains…).

• Variety of dynamic views.

• Connect/disconnect to running VMs on the fly.

• No overhead outside data gathering periods.

• Designed for very large heaps.

• Small trace files (can store and replay).

Page 10: SSCLI workshop, Redmond 19 September 2005 Richard Jones, Hanspeter Johner, Marion Sébastien University of Kent R.E.Jones@kent.ac.uk sm244@kent.ac.uk GCspy

SSCLI workshop, Redmond19 September 2005

Rotor Server

RMTk (MMTk for Rotor):

• What is MMTk (Memory Management Toolkit)?– Extensible and portable framework

– Permits efficient and reliable build of Garbage Collectors

– Originally developed for JVMs

• What is RMTk– Port of MMtk to Rotor by Andrew Gray

– Relies on GCJ (Java compiler developed by the GCC team)

Page 11: SSCLI workshop, Redmond 19 September 2005 Richard Jones, Hanspeter Johner, Marion Sébastien University of Kent R.E.Jones@kent.ac.uk sm244@kent.ac.uk GCspy

SSCLI workshop, Redmond19 September 2005

Why RMTk?

• Wider range of GCs

• Easy and efficient implementation of new GCs

• Currently implemented:– Mark-Sweep

– Semispace Copying

– Generational Copying (copy both generations)

– Generational Mark-Sweep (copy young gen, M-S old gen)

Page 12: SSCLI workshop, Redmond 19 September 2005 Richard Jones, Hanspeter Johner, Marion Sébastien University of Kent R.E.Jones@kent.ac.uk sm244@kent.ac.uk GCspy

SSCLI workshop, Redmond19 September 2005

Technical details

• Rotor's implementation:– Use of different GCs

– Requires one build per GC

• Builds:– With GCspy support or not

– With MMTk optimizations turned on or not

– One RMTk library per collector:– Contains the GCspy drivers specific to that collector– Adds wrappers to handle communication between RMTk

and GCspy

– Only one GCspy server library

Page 13: SSCLI workshop, Redmond 19 September 2005 Richard Jones, Hanspeter Johner, Marion Sébastien University of Kent R.E.Jones@kent.ac.uk sm244@kent.ac.uk GCspy

SSCLI workshop, Redmond19 September 2005 13

MMTk's integrationApplication

Communications

Event filters

Server-Interpreter

Rotor Virtual Machine

Copy GC MS GC

UsedRoots

ObjectsCardsMarked

Copy Driver MS Driver

InitData collection

MMTk GC0 MMTk GC1

UsedRoots

Copy Driver MS Driver

Init

ObjectsCards

Marked

GCspy abstractions allow easy replacement of data gathering mechanisms, collectors and VMs.

other methodspossible

GCspysynchronous

Page 14: SSCLI workshop, Redmond 19 September 2005 Richard Jones, Hanspeter Johner, Marion Sébastien University of Kent R.E.Jones@kent.ac.uk sm244@kent.ac.uk GCspy

SSCLI workshop, Redmond19 September 2005

Components interaction

GCSpy

ServerClient

RMTk

mmtk mmtktransform

jmtkbuild

gcjmmtk

RMTk librarygcspyglue

Rotor (Modified)

SSCLI

VM

libgcspy.so

: a is used and modified by b

a b

Legend:

: a generates ba b

: a composes ba b

: a interacts with ba b

Page 15: SSCLI workshop, Redmond 19 September 2005 Richard Jones, Hanspeter Johner, Marion Sébastien University of Kent R.E.Jones@kent.ac.uk sm244@kent.ac.uk GCspy

SSCLI workshop, Redmond19 September 2005

Components instrumented

A variety of different data structures have been instrumented

• Copy spaces (contiguous allocation)

• Mark-Sweep spaces

• Remembered sets

• Segregated free-lists

Page 16: SSCLI workshop, Redmond 19 September 2005 Richard Jones, Hanspeter Johner, Marion Sébastien University of Kent R.E.Jones@kent.ac.uk sm244@kent.ac.uk GCspy

SSCLI workshop, Redmond19 September 2005

GCspy client

• New plugin view mechanism:– Easy development and incorporation of new views

– History is now just another plugin

• Writing a new plugin view:– Extend PluginListener (trivial — 9 lines of code)

– Extend PluginFrame (depends on complexity of the view)

– Save as a jar file in the plugins directory

• Plugin manager:– Discovers available plugins

– Maintains a list of activated plugins

– Menu to choose the views to enable

Page 17: SSCLI workshop, Redmond 19 September 2005 Richard Jones, Hanspeter Johner, Marion Sébastien University of Kent R.E.Jones@kent.ac.uk sm244@kent.ac.uk GCspy

SSCLI workshop, Redmond19 September 2005

Benchmarks

We need better benchmarks!

• Synthetic programs OK as stress tests

• Real programs for real understanding

• Documented

• Open source

Existing benchmarks• Zorn• Krintz

Page 18: SSCLI workshop, Redmond 19 September 2005 Richard Jones, Hanspeter Johner, Marion Sébastien University of Kent R.E.Jones@kent.ac.uk sm244@kent.ac.uk GCspy

SSCLI workshop, Redmond19 September 2005

Methodology

1) RMTk without GCspy

2) RMTk + GCspy compiled in, GCspy client not connected

3) RMTk + GCspy compiled in, GCspy client connected• Object-level data acquisition

Performance overhead• GCspy client connected:

– 8.47% average

– 36.1% worst case

• GCspy client disconnected:

– Less than 2.5% average

• Caveat:

– Rotor/RMTk is significantly slower than native Rotor.

Page 19: SSCLI workshop, Redmond 19 September 2005 Richard Jones, Hanspeter Johner, Marion Sébastien University of Kent R.E.Jones@kent.ac.uk sm244@kent.ac.uk GCspy

SSCLI workshop, Redmond19 September 2005

PerformanceRaytracer

350,00

360,00

370,00

380,00

390,00

400,00

410,00

420,00

GenMS GCspy(off)

GCspy(on)

Opt GCspy(off) (opt)

GCspy(on) (opt)

GenCopy GCspy(off)

GCspy(on)

Opt GCspy(off) (opt)

GCspy(on) (opt)

Collector

Se

con

ds

GenMS GenCopy

lcscbench

0,0020,0040,0060,0080,00100,00120,00140,00160,00180,00

GenMS GCspy(off)

GCspy(on)

Opt GCspy(off) (opt)

GCspy(on) (opt)

GenCopy GCspy(off)

GCspy(on)

Opt GCspy(off) (opt)

GCspy(on) (opt)

Collector

Se

con

ds

GenMS GenCopy

Page 20: SSCLI workshop, Redmond 19 September 2005 Richard Jones, Hanspeter Johner, Marion Sébastien University of Kent R.E.Jones@kent.ac.uk sm244@kent.ac.uk GCspy

SSCLI workshop, Redmond19 September 2005 20

Conclusion

1. GCspy incorporated into Rotor through RMTk.

2. Several GCs available, all instrumented for GCspy.

3. New GCspy views.

4. Good performance.

5. Documentation: Server API, GCspy client.

6. Need interesting, open source benchmarks

Page 21: SSCLI workshop, Redmond 19 September 2005 Richard Jones, Hanspeter Johner, Marion Sébastien University of Kent R.E.Jones@kent.ac.uk sm244@kent.ac.uk GCspy

SSCLI workshop, Redmond19 September 2005

Demo

Play trace Launch gcspy

Page 22: SSCLI workshop, Redmond 19 September 2005 Richard Jones, Hanspeter Johner, Marion Sébastien University of Kent R.E.Jones@kent.ac.uk sm244@kent.ac.uk GCspy

SSCLI workshop, Redmond19 September 2005

Questions?