RFR: 8307374: Add a JFR event for tracking RSS
Roberto Castañeda Lozano
rcastanedalo at openjdk.org
Mon Jun 5 07:06:15 UTC 2023
On Fri, 2 Jun 2023 13:41:18 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:
> 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.
Thanks again for this contribution, the Linux and OS-independent parts look good!
test/jdk/jdk/jfr/event/runtime/TestResidentSetSizeEvent.java line 2:
> 1: /*
> 2: * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
Is the `2022, 2023` intentional or should it just be `2023`?
test/jdk/jdk/jfr/event/runtime/TestResidentSetSizeEvent.java line 31:
> 29: import static jdk.test.lib.Asserts.assertEquals;
> 30:
> 31: import java.time.Instant;
These three imports are unused.
-------------
Marked as reviewed by rcastanedalo (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/14285#pullrequestreview-1461839575
PR Review Comment: https://git.openjdk.org/jdk/pull/14285#discussion_r1217614714
PR Review Comment: https://git.openjdk.org/jdk/pull/14285#discussion_r1217615487
More information about the hotspot-dev
mailing list