mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-27 07:27:15 +01:00
Total Ram info inside DebugInfo command (#6507)
* add total ram available info to DebugInfo command * remove unused import
This commit is contained in:
parent
398eb64880
commit
1722d4dda0
1 changed files with 9 additions and 0 deletions
|
@ -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)");
|
||||
|
|
Loading…
Reference in a new issue