Search in sources :

Example 1 with ComputerSystem

use of oshi.hardware.ComputerSystem in project yyl_example by Relucent.

the class OshiExample method infoIdentifier.

public static void infoIdentifier(SystemInfo si) {
    OperatingSystem operatingSystem = si.getOperatingSystem();
    HardwareAbstractionLayer hardwareAbstractionLayer = si.getHardware();
    CentralProcessor centralProcessor = hardwareAbstractionLayer.getProcessor();
    ComputerSystem computerSystem = hardwareAbstractionLayer.getComputerSystem();
    String vendor = operatingSystem.getManufacturer();
    String processorSerialNumber = computerSystem.getSerialNumber();
    String uuid = computerSystem.getHardwareUUID();
    String processorIdentifier = centralProcessor.getProcessorIdentifier().getIdentifier();
    int processors = centralProcessor.getLogicalProcessorCount();
    println(// 
    String.format("%08x", vendor.hashCode()) + "-" + String.format("%08x", processorSerialNumber.hashCode()) + // 
    "-" + String.format("%08x", uuid.hashCode()) + // 
    "-" + String.format("%08x", processorIdentifier.hashCode()) + // 
    "-" + processors);
}
Also used : OperatingSystem(oshi.software.os.OperatingSystem) HardwareAbstractionLayer(oshi.hardware.HardwareAbstractionLayer) ComputerSystem(oshi.hardware.ComputerSystem) CentralProcessor(oshi.hardware.CentralProcessor)

Aggregations

CentralProcessor (oshi.hardware.CentralProcessor)1 ComputerSystem (oshi.hardware.ComputerSystem)1 HardwareAbstractionLayer (oshi.hardware.HardwareAbstractionLayer)1 OperatingSystem (oshi.software.os.OperatingSystem)1