Home Tutorials Training Consulting Products Books Company Donate Contact us









NOW Hiring

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. What is tracing?

Eclipse provides a tracing facility which can be activated on demand. If turned on, the Eclipse IDE writes additional information to a specified log file or the console.

3.2. Turning on tracing via an options file

To turn tracing on, you need to create a trace-options file. This file contains key-value pairs for the tracing options which should be turned on.

By default, this file is called .options and the Eclipse runtime looks for such a file in the Eclipse install directory. The text should contain one key=value pair per line. To turn on the trace options in the preceding two examples, you need an options file that looks like this:

# 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

You can use the corresponding preference dialog to find the values you want to enable. See Turning on tracing at runtime.

Finally, you need to enable the tracing mechanism by starting Eclipse with the -debug command line argument. You can optionally specify the location of the options file as a URL or a file-system path after the -debug argument.

# start Eclipse with the test workspace
# piping the output into a file
./eclipse -debug -data ~/test > trace.txt

For example the Starting application describes when OSGi is done with its initialization and the Application Started tells you when the application has been started. Afterwards you can extract the information which interest you the most. Here are a few commands which extract the starting time of each bundle and sort the bundles by this time.

# 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

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.3. Turning on tracing at runtime

It is also possible to turn on some tracing options at runtime via the Eclipse IDE preferences as depicted in the following screenshot.

Enable Tracing at runtime.

3.4. 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.5. 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

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.

You also need to install the Eclipse plug-ins from the following update site: http://www.yourkit.com/download/yjp2013_for_eclipse/

8. Java Mission Control

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

9. About this website

10. Eclipse tracing and performance tools resources

10.1. vogella GmbH training and consulting support

TRAINING SERVICE & SUPPORT

The vogella company provides comprehensive training and education services from experts in the areas of Eclipse RCP, Android, Git, Java, Gradle and Spring. We offer both public and inhouse training. Whichever course you decide to take, you are guaranteed to experience what many before you refer to as “The best IT class I have ever attended”.

The vogella company offers expert consulting services, development support and coaching. Our customers range from Fortune 100 corporations to individual developers.

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

See Licence.