diff --git a/Launcher/src/main/java/pro/gravit/launcher/console/test/PrintHardwareInfoCommand.java b/Launcher/src/main/java/pro/gravit/launcher/console/test/PrintHardwareInfoCommand.java index 624c249c..5c3c42a7 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/console/test/PrintHardwareInfoCommand.java +++ b/Launcher/src/main/java/pro/gravit/launcher/console/test/PrintHardwareInfoCommand.java @@ -43,6 +43,11 @@ public void invoke(String... args) throws Exception { String baseboardSerial = provider.getBaseboardSerialNumber(); currentTime = System.currentTimeMillis(); LogHelper.info("BaseboardSerial %s, TIME: %d ms", baseboardSerial, currentTime - startTime); + startTime = System.currentTimeMillis(); + String graphicCardName = provider.getGraphicCardName(); + long graphicCardVRam = provider.getGraphicCardMemory(); + currentTime = System.currentTimeMillis(); + LogHelper.info("GraphicCard %s (%.3f vram), TIME: %d ms", graphicCardName, (double) graphicCardVRam, currentTime - startTime); LogHelper.info("Hardware ID end"); } } diff --git a/Launcher/src/main/java/pro/gravit/launcher/utils/HWIDProvider.java b/Launcher/src/main/java/pro/gravit/launcher/utils/HWIDProvider.java index 40bccc9f..ff3e65e8 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/utils/HWIDProvider.java +++ b/Launcher/src/main/java/pro/gravit/launcher/utils/HWIDProvider.java @@ -1,10 +1,7 @@ package pro.gravit.launcher.utils; import oshi.SystemInfo; -import oshi.hardware.Display; -import oshi.hardware.HWDiskStore; -import oshi.hardware.HardwareAbstractionLayer; -import oshi.hardware.PowerSource; +import oshi.hardware.*; import oshi.software.os.OperatingSystem; import pro.gravit.launcher.request.secure.HardwareReportRequest; @@ -64,6 +61,36 @@ public String getHWDiskID() { return null; } + public GraphicsCard getGraphicCard() { + List graphicsCards = hardware.getGraphicsCards(); + GraphicsCard result = null; + long size = 0; + for(GraphicsCard card : graphicsCards) { + long vram = card.getVRam(); + if(vram > size) { + result = card; + size = vram; + } + } + return result; + } + + public String getGraphicCardName() { + GraphicsCard card = getGraphicCard(); + if(card == null) { + return null; + } + return card.getName(); + } + + public long getGraphicCardMemory() { + GraphicsCard card = getGraphicCard(); + if(card == null) { + return 0; + } + return card.getVRam(); + } + public byte[] getDisplayID() { List displays = hardware.getDisplays(); if (displays == null || displays.size() == 0) return null;