RFR: 8307374: Add a JFR event for tracking RSS
Stefan Karlsson
stefank at openjdk.org
Fri Jun 2 13:52:33 UTC 2023
Add A JFR event to track the resident set size (RSS) of the running process. This is a good complement to the new Native Memory Tracking events that were added for JDK 20 ([JDK-8157023](https://bugs.openjdk.org/browse/JDK-8157023))
You can use the JDK Mission Control tool to extract this data. Or, you can use the new [JFR Views](https://egahlin.github.io/2023/05/30/views.html) tool to get a textual representation of the values:
# Create a JFR recording
$ jdk/bin/java -XX:StartFlightRecording=dumponexit=true JavaApp
# Extract the data from that recording
$ jdk/bin/jfr view ResidentSetSize hotspot-pid-204767-id-1-2023_06_02_11_56_19.jfr
Resident Set Size
Time Resident Set Size Resident Set Size Peak Value
---------------- ------------------------- ------------------------------------
11:56:07 1.1 GB 1.2 GB
11:56:08 333.7 MB 1.2 GB
11:56:09 432.4 MB 1.2 GB
11:56:10 695.9 MB 1.2 GB
11:56:11 1.0 GB 1.2 GB
11:56:12 1.3 GB 1.3 GB
11:56:13 1.3 GB 1.3 GB
11:56:14 1.3 GB 1.3 GB
11:56:15 1.3 GB 1.3 GB
11:56:16 1.3 GB 1.3 GB
11:56:17 1.4 GB 1.4 GB
11:56:18 1.8 GB 1.8 GB
11:56:19 2.0 GB 2.0 GB
The event has been implemented for Linux, MacOS, and Windows. The name ResidentSetSize isn't a perfect fit for the values extracted from MacOS and Windows, but I think it is better to name this after something that many people are familiar with instead of trying to find a generic name that fits all platforms. Do you agree with that, or should we change it to something else?
I've manually sanity checked that we get reasonable values on all OS:es. I've also added a jtreg test.
-------------
Commit messages:
- Update comments in test
- Fix ifdef INCLUDE_JFR
- Expose RSS in JFR recordings (windows) and tweaks
- Expose RSS in JFR recordings (macos)
- Expose RSS in JFR recordings (linux)
Changes: https://git.openjdk.org/jdk/pull/14285/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14285&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8307374
Stats: 214 lines in 11 files changed: 214 ins; 0 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/14285.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/14285/head:pull/14285
PR: https://git.openjdk.org/jdk/pull/14285
More information about the hotspot-dev
mailing list