Home Tutorials Training Consulting Products Books Company Donate Contact us









Online training

Events

Quick links

Share

Tracing Eclipse components. This article describes how to trace and perform performance analysis on Eclipse plug-ins and RCP applications.

1. Eclipse Performance

This article gives pointers how to analyze Eclipse performance issues.

2. Monitoring the interactive UI performance with the UI freeze monitor

The Eclipse IDE includes an interactive UI performance measurement feature. If activated, a stack trace is written to the Error view, in case a UI freeze occurs.

You can activate this tracing via Window  Preferences  UI Responsiveness Monitoring

Monitoring the interactive UI performance

3. Using the build-in tracing facilities of Eclipse

3.1. Using tracing for your IDE

Eclipse provides a tracing facility which can be activated on demand. If activated, additional plug-in informations are written to the console at runtime.

You activate tracing via the -debug start parameter.

Eclipse looks now, by default, for a file called .options in the Eclipse install directory. The file must contain one key=value pair per line.

If the plug-in prepared that you can see the tracing option in the preference settings. It is also possible to active these tracing options at runtime. The Eclipse IDE preferences as depicted in the following screenshot.

Enable Tracing at runtime.

These tracing options are also available for a launch configuration.

3.1.1. Example: Tracing the startup time of plug-ins

For example, to trace the start time of each plug-in during startup you need the following content.

# turn on debugging for the org.eclipse.core plugin.
org.eclipse.osgi/debug=true

# turn on loading time for the plug-ins
org.eclipse.osgi/debug/bundleTime=true

To use these settings, start Eclipse via the following command line.

./eclipse -debug

Most tracing options are also accessible via the UI. See [tracing_runonatruntime].

You can also specify the location of the options file as a URL or a file-system path after the -debug argument.

In this example the Starting application timestamp describes when OSGi is done with its initialization. The Application Started tells you when the application has been started. Afterwards you can extract the information which interest you the most. For the above example, the following is a small shell script this extracts the starting time of each bundle and sort the bundles by this time.

# start Eclipse with at test workspace while piping the output into a file
./eclipse -debug -data ~/test > trace.txt
# extract the lines starting with "End starting"
grep "End starting" trace.txt  >trace2.txt
# extract plug-in name and startup time and sort by time
awk '{print $5 " " $3}' trace2.txt | sort -nr > tracefinal.txt

3.1.2. Example: Tracing the resource plug-in

The following is another example for an .option file in which you trace the resources.

# turn on debugging for the org.eclipse.core.resources plugin.
org.eclipse.core.resources/debug=true

# monitor builders and gather time statistics etc.
org.eclipse.core.resources/perf/builders=10000

# monitor resource change listeners and gather time statistics etc.
org.eclipse.core.resources/perf/listeners=500

# monitor workspace snapshot and gather time statistics etc.
org.eclipse.core.resources/perf/snapshot=1000

# monitor workspace snapshot and gather time statistics etc.
org.eclipse.core.resources/perf/save.participants=500

# debug build failure cases such as failure to retrieve deltas.
org.eclipse.core.resources/build/failure=true

# reports the cause of autobuild interruption
org.eclipse.core.resources/build/interrupt=true

# reports the start and end of all builder invocations
org.eclipse.core.resources/build/invoking=true

# reports the start and end of build delta calculations
org.eclipse.core.resources/build/delta=true

# for incremental builds, displays which builder is being run
# and because of changes in which project.
org.eclipse.core.resources/build/needbuild=true

# prints a stack trace every time an operation finishes that requires a
build
org.eclipse.core.resources/build/needbuildstack=true

# prints a stack trace every time a build API method is called
org.eclipse.core.resources/build/stacktrace=false

# report debug of workspace auto-refresh
org.eclipse.core.resources/refresh=true

3.2. Implement tracing for your plug-in

Can you also implement tracing for your custom plug-in, see Using Eclipse Tracing API. To add your tracing options to the preference preference page, to allow users to turn them on at run time, use extension point the org.eclipse.ui.trace.traceComponents. See TracingPreferencePage for the implementation of this.

3.3. Example: for key bindings

The tracing functionality of Eclipse allows to you trace which command is associated with a certain key binding. The following listing contains the trace options to enable that.

# turn on debugging for the org.eclipse.core.resources plugin.
org.eclipse.ui/debug=true
org.eclipse.ui/trace/keyBindings
org.eclipse.ui/trace/keyBindings.verbose

4. Performance traces

The Eclipse platform supports the creation of performance traces via the PerformanceStats class. See Gathering performance statistics for more details.

5. Automated tests

The Eclipse project supports automated tests to continuously run benchmarks.

6. Eclipse Sleak

Eclipse Sleak monitors the creation and disposal of SWT graphics resources. Get it from the SWT Development Tools or install the Eclipse Plugin via the SWT Tools Update Sites.

To activate Sleak, you can use the Tracing tab in your Eclipse runtime configuration.

sleaktrace10
sleaktrace20

Alternatively you can also activate it for your Eclipse IDE. For this you have to start Eclipse with the -debug option from the command line. You also need to create a .options file in the Eclipse installation directory with the following entries.

org.eclipse.ui/debug=true
org.eclipse.ui/trace/graphics=true

If you start your Eclipse IDE, you find the Sleak view under Window  Show View  Other …​  SWT Tools  Sleak.

Sleak allows you to take a snapshot and create a diff. Clicking on Stacktrace gives you the stacktrace in which the resource was allocated.

7. Yourkit

7.1. What is Yourkit

Yourkit is a commercial tool for performance tracing and analysis. You require a license to use it but Yourkit offers free licencses to Open Source projects.

To install Yourkit, you need to download if from Yourkit download. Depending your platform you can the installer (Windows) or extract the compressed archive to your system.

On Linux extract it to a folder of your choice. In this folder you find the script bin/yjp.sh to start Yourkit. The Yourkit tooling starts and ask you for the license key and with which IDE it should integrate.

To trace IDE tools like Eclipse you need to remove the filter flag.

yourkit ide tracing

8. Java Mission Control

Java Mission Control is set of tools to perform performance analysis of a Java application.

9. Eclipse tracing and performance tools resources

10. vogella training and consulting support

Copyright © 2012-2018 vogella GmbH. Free use of the software examples is granted under the terms of the Eclipse Public License 2.0. This tutorial is published under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Germany license.