diff --git a/src/main/java/com/simibubi/create/infrastructure/debugInfo/DebugInformation.java b/src/main/java/com/simibubi/create/infrastructure/debugInfo/DebugInformation.java index ac34ab7b3..120392857 100644 --- a/src/main/java/com/simibubi/create/infrastructure/debugInfo/DebugInformation.java +++ b/src/main/java/com/simibubi/create/infrastructure/debugInfo/DebugInformation.java @@ -26,6 +26,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.ModList; import net.minecraftforge.forgespi.language.IModInfo; +import oshi.SystemInfo; /** * Allows for providing easily accessible debugging information. @@ -86,6 +87,7 @@ public class DebugInformation { .put("Java Version", SystemReportAccessor.getJAVA_VERSION()) .put("JVM Flags", getMcSystemInfo("JVM Flags")) .put("Memory", () -> getMcSystemInfo("Memory")) + .put("Total Memory", getTotalRam()) .put("CPU", getCpuInfo()) .putAll(listAllGraphicsCards()) .buildTo(DebugInformation::registerBothInfo); @@ -129,6 +131,13 @@ public class DebugInformation { return cards.isEmpty() ? List.of(new InfoEntry("Graphics cards", "none")) : cards; } + public static String getTotalRam() { + long availableMemory = new SystemInfo().getHardware().getMemory().getAvailable(); + long totalMemory = new SystemInfo().getHardware().getMemory().getTotal(); + long usedMemory = totalMemory - availableMemory; + return String.format("%s bytes (%s MiB) / %s bytes (%s MiB)", usedMemory, usedMemory / 1049000, totalMemory, totalMemory / 1049000); + } + public static String getCpuInfo() { String name = tryTrim(getMcSystemInfo("Processor Name")); String freq = getMcSystemInfo("Frequency (GHz)");