Skip to content

Commit

Permalink
Revert "Add support for CgroupMetrics.getTotalMemory0"
Browse files Browse the repository at this point in the history
This reverts commit 3dcf7c7.
  • Loading branch information
zakkak committed Jun 6, 2023
1 parent b430cb1 commit 5cc919c
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 107 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,17 @@

import static com.oracle.svm.core.Containers.Options.UseContainerSupport;

import org.graalvm.nativeimage.ImageSingletons;
import org.graalvm.nativeimage.Platform;
import org.graalvm.nativeimage.Platforms;

import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;
import com.oracle.svm.core.annotate.TargetElement;
import com.oracle.svm.core.heap.PhysicalMemory.PhysicalMemorySupport;

@Platforms(Platform.LINUX.class)
@TargetClass(className = "jdk.internal.platform.CgroupMetrics", onlyWith = CgroupMetricsJDK.class)
@TargetClass(className = "jdk.internal.platform.CgroupMetrics")
public final class Target_jdk_internal_platform_CgroupMetrics {
@Substitute
public static boolean isUseContainerSupport() {
return UseContainerSupport.getValue();
}

@Substitute
@TargetElement(onlyWith = HasGetTotalMemorySize0.class)
public static long getTotalMemorySize0() {
// We ought not to use PhysicalMemory.size() here since that might return the
// container memory which we explicitly want to avoid for this method. It serves
// as an upper bound of the container memory.
return ImageSingletons.lookup(PhysicalMemorySupport.class).size().rawValue();
}
}

0 comments on commit 5cc919c

Please sign in to comment.