Menu

Home

Stefan Anzinger

How to install

The Graal Profiling Data Viewer is not part of the Graal repository, therefore the installation is separated.
To access the internal data structures, some parts of the existing code in Graal need to be patched. Later more.

Prerequisites

Procedure

First we need to get the PDV Repository:

hg clone http://hg.code.sf.net/p/graalpdv/code ~/dev/pdv2

In the next step we need to apply the patch and link the sources (Via symlink) into the Graal repository. Run the script ~/dev/pdv/install.sh

$ ~/dev/pdv/install.sh
---------------------------------------------------------------------------
Patching Graal code
---------------------------------------------------------------------------
patching file graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java
patching file graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java
patching file graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java
patching file graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeDisassembler.java
patching file mx/projects
patching file src/share/vm/graal/graalCompilerToVM.cpp
---------------------------------------------------------------------------
Patch completed successfully, creating symlink from graal repository to pdv
---------------------------------------------------------------------------
Creating symlink to the PDV code in the Graal repository
./pdv/pdv’ -> ‘/home/stefan/dev/pdv/pdv’
---------------------------------------------------------------------------
SUCCESS: Installed PDV in the Graal sourcecode, now you may run 
          > mx.sh build
---------------------------------------------------------------------------

Now we run the Graal build:

cd $GRAAL_HOME
./mx.sh ideinit
./mx.sh build

In Eclipse we have to add the new generated projects to the workspace by choosing "Import" > "Existing Projects into Workspace" and choose directory ~/dev/pdv/ for scanning.

Project Structure/Dependencies

The following Figure illustrates the dependencies between the various projects in PDV. The dependencies are straight forward. The Agent runs in the Graal VM and a client library is used by the profiling UI, both projects use the protocol library (Data is transferred as serialized object of classes from the protocol project).

The following Figure shows the schematic of the whole application:

Installing PDV Eclipse Plugin

For running a profiling session, you need a runnig Graal VM with the PDV patch (Instructions above) and the PDV Eclipse plugin.

Prerequisites

  • Eclipse >= 4.3
  • Windows/Linux/MacOS

Download the Eclipse plugin from the download page. Install the Plugin in Eclipse by choosing "Help" > "Install new software". Choose the archive file and proceed with the wizard.

Run a profiling session

A profiling session can be initiated in two different ways. The first way is to launch the Application you want to profile with the Eclipse Launcher, the other alternative is to do run the Graal VM with appropriate command line arguments to connect to the profiling UI.

Variant 1: Use the Eclipse launcher

To be able to launch the Graal VM in Eclipse, you need to add the Graal VM as Java VM to the Eclipse configuration. In configuration dialog "Window" > "Properties" > "Java" > "Installed JREs" select the VM $GRAAL_HOME/jdk_1.7.0_xx/ as shown in the screenshot below.

Now create a new launch configuration in dialog "Run" > "Profile Graal Configurations". In the tab "JRE" choose the configured Graal VM instead of the HotSpot VM.

Now you can launch the configuration and the "Graal Profiling Session" view shows the running session.

When opening a Java sourcecode file in the Java Editor where profiling data is available, the column for Graal profiling should appear.

If not, click right on the left Editor column, as in the screenshot below and check if "Graal Profiling Colum" is checked.

If the column still does not show up, there might not by any profiling data for this class. Try another class, for example java.util.HashMap.

Variant 2: Remote

You can do a remote profiling session as well in analogy to the remote debug session in Java.

For this, you need to start the profiling listener in Eclipse. Open the view "Graal Profiling Sessions". In this view choose a listening port and click "Start". This opens a TCP port and listens for incoming connections from Graal VMs to be profiled.

Now start the Graal VM with the VM Parameter -G:ProfileGraal=localhost:8000. For example:

./mx.sh vm -XX:-BootstrapGraal -G:ProfileGraal=localhost:8000 -cp ~/runtime-EclipseApplication/Test/bin/ test.TestClass

Project Members: