Skip to content

Commit

Permalink
Merge pull request #1471 from Sreekala-Gopakumar/1469XXFltRcrd
Browse files Browse the repository at this point in the history
Added -XX:[+|-]FlightRecorder` option - JFR
  • Loading branch information
tajila authored Jan 20, 2025
2 parents 8eeb8bc + a4f6051 commit 70e5fb8
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/version0.49.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ The following new features and notable changes since version 0.48.0 are included
- [Change to the shared classes cache generation number](#change-to-the-shared-classes-cache-generation-number)
- [New shared classes cache suboption added to adjust the number of startup hints that can be stored](#new-shared-classes-cache-suboption-added-to-adjust-the-number-of-startup-hints-that-can-be-stored)
- [`subAllocator` related `-Xgc` options are added to control the compressed reference allocation](#suballocator-related-xgc-options-are-added-to-control-the-compressed-reference-allocation)
- ![Start of content that applies to Java 11 (LTS) and later](cr/java11plus.png) [New `-XX:[+|-]FlightRecorder` option added](#new-xx-flightrecorder-option-added) ![End of content that applies only to Java 11 and later](cr/java_close.png)

## Features and changes

Expand Down Expand Up @@ -66,6 +67,12 @@ The VM can use compressed references to decrease the size of Java objects and ma

For more information, see [Compressed references](allocation.md#compressed-references).

### ![Start of content that applies to Java 11 (LTS) and later](cr/java11plus.png) New `-XX:[+|-]FlightRecorder` option added

This release supports, as a technical preview, the Java Flight Recorder (JFR) tool that is available for OpenJDK 11 and later running on Linux® x86 and Linux on AArch64 only.

You can collect profiling and diagnostic information with the JFR tool. You can enable or disable the JFR tool in the VM with the [`-XX:[+|-]FlightRecorder`](xxflightrecorder.md) option. ![End of content that applies only to Java 11 and later](cr/java_close.png)

## Known problems and full release information

To see known problems and a complete list of changes between Eclipse OpenJ9 v0.48.0 and v0.49.0 releases, see the [Release notes](https://github.com/eclipse-openj9/openj9/blob/master/doc/release-notes/0.49/0.49.md).
Expand Down
73 changes: 73 additions & 0 deletions docs/xxflightrecorder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<!--
* Copyright (c) 2017, 2024 IBM Corp. and others
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution and is available at
* https://www.eclipse.org/legal/epl-2.0/ or the Apache
* License, Version 2.0 which accompanies this distribution and
* is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* This Source Code may also be made available under the
* following Secondary Licenses when the conditions for such
* availability set forth in the Eclipse Public License, v. 2.0
* are satisfied: GNU General Public License, version 2 with
* the GNU Classpath Exception [1] and GNU General Public
* License, version 2 with the OpenJDK Assembly Exception [2].
*
* [1] https://www.gnu.org/software/classpath/license.html
* [2] https://openjdk.org/legal/assembly-exception.html
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0
-->

# -XX:[+|-]FlightRecorder

**Linux&reg; on x86, Linux on AArch64**

![Start of content that applies to Java 11 (LTS) and later](cr/java11plus.png) This option enables or disables the Java Flight Recorder (JFR) tool in the VM. This built-in profiling and troubleshooting tool in the VM collects profiling and diagnostic information.

:fontawesome-solid-pencil:{: .note aria-hidden="true"} **Note:** Support for the JFR tool is currently provided as a technical preview. All JFR-related `jcmd` options might change in future releases.

## Syntax

-XX:[+|-]FlightRecorder

| Setting | Effect | Default |
|------------------------------------|---------|:----------------------------------------------------------------------------------:|
| `-XX:+FlightRecorder` | Enable | :fontawesome-solid-check:{: .yes aria-hidden="true"}<span class="sr-only">yes</span> |
| `-XX:-FlightRecorder` | Disable | |

## Explanation

If the JFR tool is enabled in the VM with the `-XX:+FlightRecorder` option, then you can trigger profile and diagnostic recording with the [`jcmd`](https://eclipse.dev/openj9/docs/tool_jcmd/) tool. Recording does not start automatically, it must be triggered.

To start a recording, specify the following command:

```
jcmd <vmid | display name | 0> JFR.start [filename=<file_name_with_path>] [duration=<time_with_unit_of_time>]
```
where:

- Optional parameters are shown in brackets, [ ].

- `filename=<file_name_with_path>` specifies the name of the file and its location where the recording is saved. The file name should have a `.jfr` extension. If a file name is not specified, the recording is saved in the `defaultJ9recording.jfr` file in the process working directory by default.

- `duration=<time_with_unit_of_time>` specifies the duration of the recording. Units of time are `s` (seconds), `m` (minutes), `h` (hours), and `d` (days). You can specify only one unit of time, for example, 54s, 12m, 1h, or 2d. If the duration is not specified, the tool continues to record until the recording is manually stopped or the VM is shut down.

Example:

```
jcmd 1234 JFR.start filename=/path/ABCD.jfr duration=4s
```

![End of content that applies to Java 11 (LTS) and later](cr/java_close.png)

## See Also

- [What's new in version 0.49.0](version0.49.md#new-xx-flightrecorder-option-added)


<!-- ==== END OF TOPIC ==== xxflightrecorder.md ==== -->
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ nav:
- "-XX:[+|-]EnableExtendedHCR" : xxenableextendedhcr.md
- "-XX:[+|-]EnsureHashed" : xxensurehashed.md
- "-XX:[+|-]ExitOnOutOfMemoryError" : xxexitonoutofmemoryerror.md
- "-XX:[+|-]FlightRecorder" : xxflightrecorder.md
- "-XX:[+|-]GlobalLockReservation" : xxgloballockreservation.md
- "-XX:[+|-]HandleSIGABRT" : xxhandlesigabrt.md
- "-XX:[+|-]HandleSIGUSR2" : xxhandlesigusr2.md
Expand Down

0 comments on commit 70e5fb8

Please sign in to comment.