4 Controlling Recording Data by Using Templates

This chapter describes how to use templates for controlling the information that the flight recordings capture.

This chapter contains the following sections:

4.1 What You Can Control

Almost everything about JRockit Flight Recorder can be controlled through different kinds of settings. To control the amount of data that is recorded, you can configure the following information for each type of event:

  • Enabled; you can enable or disable each event type for a particular recording. Disabling events that occur often (such as synchronization events) helps reduce the size of the recording.

  • Threshold; you can filter events that have duration by setting a threshold. Events with shorter duration than the threshold are not saved.

  • Stack trace; you can enable or disable stack trace information for each event for the point from which the event is generated. Creating stack traces can be costly but can be extremely helpful to understanding why the event happened.

  • Request periods; you can configure the frequency with which a requestable events is requested by the JRockit Flight Recorder run time.

JRockit Flight Recorder uses templates so that you do not need to modify all these configuration options every time you start a recording. Sets of best-known options for different tasks have been stored in both Mission Control templates and server-side templates. You can use these templates as is or you can modify them to suit your needs.


Even though the data format for a flight recording (.jfr) file is extremely compact, enabling too many event types in the recording, especially resource heavy ones—such as those that frequently collect stack traces—might produce large amounts of data.

4.2 Mission Control Templates

When you start a recording in JRockit Mission Control Client, you will be prompted for a recording template (see Figure 2-1). The template controls which events will be enabled during the recording. The following templates are available by default:

4.2.1 Profiling Normal

This template includes most of the profiling events of interest. Some very low level events and very resource hungry events have been left out to ensure that the overhead remains low.

Overhead: Since this template's recording overhead is very low, you can use it in a production environment. See the JRockit Flight Recorder online help for more information.

4.2.2 Profiling with Locks

This template is very similar to the normal profiling template, except that it also includes very low level locking events. This profile is useful when you are hunting down lock-related issues; however, it will incur more overhead than the normal template. You must start the JVM with -XX:+UseLockProfiling for this template to work

Overhead: Since the JVM must be started with a flag that incurs overhead even when not profiling, you should not use this template in a production environment.

4.2.3 Profiling with Exceptions

This template is very similar to the normal profiling template but it also includes exception events with stack traces. This profile can be quite expensive if the application throws a lot of exceptions. Of course, if that is happening, the application is very likely running slower than it should. This profile is useful when you are hunting down exception related issues but it, too, incurs more overhead than the normal template.

Overhead: You can use this template in a production environment but be aware it incurs more overhead than the default. This overhead is proportional to the number of exceptions being thrown

4.2.4 Real Time

This template focuses on memory system related information, such as garbage collection information. It uses the same event types as the built-in default recording.

Overhead: You can use this template in a production environment. It is enabled by default and no overhead is introduced. See the JRockit Flight Recorder online help for more information

4.2.5 Modifying a Template

You can modify a template to change exactly which events are recorded and how. Click on "Advanced…" to do this. Templates can be saved to disk and shared with others.

4.2.6 Server-side Templates

When starting a recording from the command line or by using a diagnostic command, a number of different templates are available ready-to-use. Table 4-1 describes this templates.

Table 4-1 Server-side Templates

Template Name Description


Additional settings for enabling more verbose compiler logging.


Default settings tuned for a very low performance overhead and recommended for always-on production use.


Additional settings for debugging out-of-memory and fragmentation problems.


Enables collection of all available events for all subsystems. Warning: This has a very high performance overhead.


Additional settings for enabling more verbose Java I/O logging.


Additional settings for debugging memory leaks.


Additional settings for enabling more verbose synchronization logging.


Additional settings for enabling more verbose GC/memory management logging.


Disables all events for all subsystems.


Recommended settings for creating a profiling recording. They provide a good balance between the amount of information available and the performance overhead introduced.


Additional settings for enabling hotspot sampling of code.


Additional settings for debugging problems with java.lang.ref.Reference objects and its subclasses.

Specify templates with the settings parameter when staring a recording; for example:

jrcmd <pid> start_flightrecording duration=5min settings=io



The preceding example shows how you can combine templates by specifying several settings parameters.

You can also design custom templates by creating your own template file. The templates are stored in .jfs files in the directory JROCKIT_HOME/jre/lib/jfr. The easiest way to create your own template is to make a copy of one of the existing files and modify it. For a detailed description of the file format, see Section A.3, "File Format".