RFR: JDK-8324287: Record total and free swap space in JFR [v6]

Severin Gehwolf sgehwolf at openjdk.org
Wed Jan 31 10:00:04 UTC 2024


On Tue, 30 Jan 2024 16:17:49 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

>> Total and free swap space should be recorded in JFR, because it is important to know e.g. in case of memory shortages.
>> 
>> Currently we only have a container related event (ContainerMemoryUsage) that provides some info but no general event.
>> PhysicalMemory could be enhanced or a new event added.
>> 
>> There is already some coding (see Java_com_sun_management_internal_OperatingSystemImpl_getTotalSwapSpaceSize0 and
>> Java_com_sun_management_internal_OperatingSystemImpl_getFreeSwapSpaceSize0) for the swap space info retrieval.
>
> Matthias Baesken has updated the pull request incrementally with one additional commit since the last revision:
> 
>   some Linux container related adjustments

Seems OK. The testing could get improved. Only test the non-container case in the existing test and test the container case (including `-1`) in the corresponding container test.

test/jdk/jdk/jfr/event/os/TestSwapSpaceEvent.java line 38:

> 36:  * @requires vm.hasJFR
> 37:  * @library /test/lib
> 38:  * @run main/othervm jdk.jfr.event.os.TestSwapSpaceEvent

I'd suggest to use `-XX:-UseContainerSupport` on this test to exercise the non-container case on Linux. If you want to test the container case as well, add it to `test/hotspot/jtreg/containers/docker/TestJFREvents.java`.

-------------

PR Review: https://git.openjdk.org/jdk/pull/17581#pullrequestreview-1853322888
PR Review Comment: https://git.openjdk.org/jdk/pull/17581#discussion_r1472575158


More information about the hotspot-jfr-dev mailing list