Skip to content

Commit

Permalink
8244500: jtreg test error in test/hotspot/jtreg/containers/docker/Tes…
Browse files Browse the repository at this point in the history
…tMemoryAwareness.java

When the kernel doesn't support swap limits, expect host values instead.

Reviewed-by: sgehwolf
Backport-of: fb5132254d834ba01a4b65ce64143843e83c674e
  • Loading branch information
Jonathan Dowland committed Dec 12, 2022
1 parent 989d68f commit 4ab80ff
Showing 1 changed file with 9 additions and 0 deletions.
Expand Up @@ -24,11 +24,20 @@

import com.sun.management.OperatingSystemMXBean;
import java.lang.management.ManagementFactory;
import jdk.internal.platform.Metrics;

public class CheckOperatingSystemMXBean {

public static void main(String[] args) {
System.out.println("Checking OperatingSystemMXBean");
Metrics metrics = jdk.internal.platform.Container.metrics();
System.out.println("Metrics instance: " + (metrics == null ? "null" : "non-null"));
if (metrics != null) {
System.out.println("Metrics.getMemoryAndSwapLimit() == " + metrics.getMemoryAndSwapLimit());
System.out.println("Metrics.getMemoryLimit() == " + metrics.getMemoryLimit());
System.out.println("Metrics.getMemoryAndSwapUsage() == " + metrics.getMemoryAndSwapUsage());
System.out.println("Metrics.getMemoryUsage() == " + metrics.getMemoryUsage());
}

OperatingSystemMXBean osBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
System.out.println(String.format("Runtime.availableProcessors: %d", Runtime.getRuntime().availableProcessors()));
Expand Down

1 comment on commit 4ab80ff

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.