CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-com-github-oshi--oshi-core

JNA-based operating system and hardware information library for Java providing cross-platform access to system metrics

Pending
Overview
Eval results
Files

hardware.mddocs/

Hardware Information

Comprehensive hardware component access including CPU, memory, storage, network interfaces, and sensors with detailed performance metrics.

HardwareAbstractionLayer Interface

The hardware abstraction layer provides access to hardware items such as processors, memory, battery, and disks.

interface HardwareAbstractionLayer {
    ComputerSystem getComputerSystem();
    CentralProcessor getProcessor();
    GlobalMemory getMemory();
    List<PowerSource> getPowerSources();
    List<HWDiskStore> getDiskStores();
    List<LogicalVolumeGroup> getLogicalVolumeGroups();
    List<NetworkIF> getNetworkIFs();
    List<NetworkIF> getNetworkIFs(boolean includeLocalInterfaces);
    List<Display> getDisplays();
    Sensors getSensors();
    List<UsbDevice> getUsbDevices(boolean tree);
    List<SoundCard> getSoundCards();
    List<GraphicsCard> getGraphicsCards();
}

Computer System Information

Physical hardware information including BIOS/firmware and motherboard details.

interface ComputerSystem {
    String getManufacturer();
    String getModel();
    String getSerialNumber();
    String getHardwareUUID();
    Firmware getFirmware();
    Baseboard getBaseboard();
}

interface Firmware {
    String getManufacturer();
    String getName();
    String getDescription();
    String getVersion();
    String getReleaseDate();
}

interface Baseboard {
    String getManufacturer();
    String getModel();
    String getVersion();
    String getSerialNumber();
}

Central Processor (CPU)

Represents the entire CPU including physical packages, cores, and logical processors.

interface CentralProcessor {
    ProcessorIdentifier getProcessorIdentifier();
    long getMaxFreq();
    long[] getCurrentFreq();
    List<LogicalProcessor> getLogicalProcessors();
    List<PhysicalProcessor> getPhysicalProcessors();
    List<ProcessorCache> getProcessorCaches();
    long getSystemCpuLoadBetweenTicks(long[] oldTicks);
    double getSystemCpuLoad(long delay);
    double[] getProcessorCpuLoadBetweenTicks(long[][] oldTicks);
    double[] getProcessorCpuLoad(long delay);
    long[] getSystemCpuLoadTicks();
    long[][] getProcessorCpuLoadTicks();
    int getLogicalProcessorCount();
    int getPhysicalProcessorCount();
    int getPhysicalPackageCount();
    long getContextSwitches();
    long getInterrupts();
    
    class ProcessorIdentifier {
        String getVendor();
        String getName();
        String getFamily();
        String getModel();
        String getStepping();
        String getProcessorID();
        String getIdentifier();
        boolean isCpu64bit();
    }
    
    class LogicalProcessor {
        int getProcessorNumber();
        int getPhysicalPackageNumber();
        int getPhysicalProcessorNumber();
        int getNumaNode();
        int getProcessorGroup();
    }
    
    class PhysicalProcessor {
        int getPhysicalPackageNumber();
        int getPhysicalProcessorNumber();
        String getIdString();
        int getEfficiencyClass();
    }
    
    enum TickType {
        USER, NICE, SYSTEM, IDLE, IOWAIT, IRQ, SOFTIRQ, STEAL, GUEST, GUEST_NICE
    }
}

Memory Information

System memory including RAM, virtual memory, and physical memory modules.

interface GlobalMemory {
    long getTotal();
    long getAvailable();
    long getPageSize();
    VirtualMemory getVirtualMemory();
    List<PhysicalMemory> getPhysicalMemory();
}

interface VirtualMemory {
    long getSwapTotal();
    long getSwapUsed();
    long getVirtualMax();
    long getVirtualInUse();
    long getSwapPagesIn();
    long getSwapPagesOut();
}

interface PhysicalMemory {
    String getBankLabel();
    long getCapacity();
    long getClockSpeed();
    String getManufacturer();
    String getMemoryType();
    String getPartNumber();
    String getSerialNumber();
}

Storage Devices

Hard disks and storage device information.

interface HWDiskStore {
    String getName();
    String getModel();
    String getSerial();
    long getSize();
    long getReads();
    long getReadBytes();
    long getWrites();
    long getWriteBytes();
    long getCurrentQueueLength();
    long getTransferTime();
    List<HWPartition> getPartitions();
    long getTimeStamp();
    boolean updateAttributes();
}

interface HWPartition {
    String getIdentification();
    String getName();
    String getType();
    String getUuid();
    long getSize();
    int getMajor();
    int getMinor();
    String getMountPoint();
}

interface LogicalVolumeGroup {
    String getName();
    Map<String, Set<String>> getLogicalVolumes();
    Set<String> getPhysicalVolumes();
}

Network Interfaces

Network interface information and statistics.

interface NetworkIF {
    String getName();
    String getDisplayName();
    int getIndex();
    long getMTU();
    String getMacaddr();
    String[] getIPv4addr();
    Short[] getSubnetMasks();
    String[] getIPv6addr();
    Short[] getPrefixLengths();
    long getBytesRecv();
    long getBytesSent();
    long getPacketsRecv();
    long getPacketsSent();
    long getInErrors();
    long getOutErrors();
    long getInDrops();
    long getCollisions();
    long getSpeed();
    long getTimeStamp();
    boolean isKnownVmMacAddr();
    IfType getIfType();
    boolean updateAttributes();
    
    enum IfType {
        OTHER, REGULAR1822, HDH1822, DDN_X25, RFC877X25, ETHERNET_CSMACD,
        ISO88023_CSMACD, ISO88024_TOKENBUS, ISO88025_TOKENRING, ISO88026_MAN,
        STARLAN, PROTEON_10MBIT, PROTEON_80MBIT, HYPERCHANNEL, FDDI, LAPB,
        SDLC, DS1, E1, BASIC_ISDN, PRIMARY_ISDN, PROP_PTP_SERIAL, PPP,
        SOFTWARE_LOOPBACK, EON, ETHERNET_3MBIT, NSIP, SLIP, ULTRA, DS3, SIP,
        FRAMERELAY, RS232, PARA, ARCNET, ARCNETPLUS, ATM, MIOX25, SONET,
        X25PLE, ISO88022LLC, LOCALTALK, SMDSDXI, FRAMERELAYSERVICE, V35,
        HSSI, HIPPI, MODEM, AAL5, SONETPATH, SONET_VT, SMDS_ICIP, PROP_VIRTUAL,
        PROP_MULTIPLEXOR, IEEE80212, FIBRECHANNEL, HIPPIINTERFACE, FRAMERELAYINTERCONNECT,
        AFLANE_8023, AFLANE_8025, CCTEMUL, FASTETHER, ISDN, V11, V36, G703_64K,
        G703_2MB, QLLC, FASTETHERFX, CHANNEL, IEEE80211, IBM370PARCHAN,
        ESCON, DLSW, ISDN_S, ISDN_U, LAPD, IPSWITCH, RSRB, ATM_LOGICAL,
        DS0, DS0_BUNDLE, BSC, ASYNC, CNR, ISO88025R_DTR, EPLRS, ARAP,
        PROP_CNLS, HOSTPAD, TERMPAD, FRAMERELAY_MPI, X213, ADSL, RADSL,
        SDSL, VDSL, ISO88025_CRFPRINT, MYRINET, VOICE_EM, VOICE_FXO,
        VOICE_FXS, VOICE_ENCAP, VOICE_OVERIP, ATM_DXI, ATM_FUNI, ATM_IMA,
        PPPMULTILINKBUNDLE, IPOVERCDLC, IPOVERCLAW, STACKTOSTACK, VIRTUALIPADDRESS,
        MPC, IPOVERATM, ISO88025_FIBER, TDLC, GIGABITETHERNET, HDLC, LAPF,
        V37, X25MLP, X25HUNTGROUP, TRANSPHDLC, INTERLEAVE, FAST, IP,
        DOCSCABLEMACLAYER, DOCSCABLEDOWNSTREAM, DOCSCABLEUPSTREAM, A12MPPSWITCH,
        TUNNEL, COFFEE, CES, ATM_SUBINTERFACE, L2_VLAN, L3_IPVLAN, L3_IPXVLAN,
        DIGITALPOWERLINE, MEDIAMAILOVERIP, DTM, DCN, IPFORWARD, MSDSL,
        IEEE1394, IF_GSN, DVBRCC_MACLAYER, DVBRCC_DOWNSTREAM, DVBRCC_UPSTREAM,
        ATM_VIRTUAL, MPLS_TUNNEL, SRP, VOICEOVERATM, VOICEOVERFRAMERELAY,
        IDSL, COMPOSITELINK, SS7_SIGLINK, PROP_WIRELESS_P2P, FR_FORWARD,
        RFC1483, USB, IEEE8023AD_LAG, BGP_POLICY_ACCOUNTING, FRF16_MFR_BUNDLE,
        H323_GATEKEEPER, H323_PROXY, MPLS, MF_SIGLINK, HDSL2, SHDSL,
        DS1_FDL, POS, DVB_ASI_IN, DVB_ASI_OUT, PLC, NFAS, TR008, GR303_RDT,
        GR303_IDT, ISUP, PROP_DOCSWIRELESS_MACLAYER, PROP_DOCSWIRELESS_DOWNSTREAM,
        PROP_DOCSWIRELESS_UPSTREAM, HIPERLAN2, PROP_BWA_P2MP, SONET_OVERHEAD_CHANNEL,
        DIGITAL_WRAPPER_OVERHEAD_CHANNEL, AAL2, RADIO_MAC, ATM_RADIO,
        IMT, MVL, REACH_DSL, FR_DLCI_ENDPT, ATM_VCI_ENDPT, OPTICAL_CHANNEL,
        OPTICAL_TRANSPORT, IEEE80216_WMAN, ADSL2, MACSECCONTROLLEDIF,
        MACSECUNCONTROLLEDIF, AVICI_OPTICAL_ETHER, ATMBOND, VOICE_FGDN,
        VOICE_FGDS, VOICE_FGD, ISDN_Q921, ISDN_Q931, ISDN_QSIG, LAN,
        WIRELESS_LAN, BRIDGE, LINECONFIG, WWAN, WWANPP, WWANPP2, VOICEOTHER,
        OTHER_WWAN, UNKNOWN
    }
}

Power Sources

Battery and power supply information.

interface PowerSource {
    String getName();
    String getDeviceName();
    double getRemainingCapacityPercent();
    double getTimeRemainingEstimated();
    double getTimeRemainingInstant();
    double getPowerUsageRate();
    double getVoltage();
    double getAmperage();
    boolean isPowerOnLine();
    boolean isCharging();
    boolean isDischarging();
    CapacityUnits getCapacityUnits();
    int getCurrentCapacity();
    int getMaxCapacity();
    int getDesignCapacity();
    int getCycleCount();
    String getChemistry();
    LocalDate getManufactureDate();
    String getManufacturer();
    String getSerialNumber();
    double getTemperature();
    
    enum CapacityUnits {
        RELATIVE, MAH, MWH
    }
}

Sensors

Hardware sensor information for temperature, voltage, and fan speeds.

interface Sensors {
    double getCpuTemperature();
    int[] getFanSpeeds();
    double getCpuVoltage();
}

Displays

Monitor and display information.

interface Display {
    byte[] getEdid();
}

USB Devices

USB device information and hierarchy.

interface UsbDevice {
    String getName();
    String getVendor();
    String getVendorId();
    String getProductId();
    String getSerialNumber();
    String getUniqueDeviceId();
    List<UsbDevice> getConnectedDevices();
}

Sound Cards

Audio device information.

interface SoundCard {
    String getDriverVersion();
    String getName();
    String getCodec();
}

Graphics Cards

Graphics device information.

interface GraphicsCard {
    String getName();
    String getDeviceId();
    String getVendor();
    String getVersionInfo();
    long getVRam();
}

Usage Examples

CPU Information

import oshi.SystemInfo;
import oshi.hardware.CentralProcessor;

SystemInfo si = new SystemInfo();
CentralProcessor cpu = si.getHardware().getProcessor();

// Basic CPU info
System.out.println("CPU: " + cpu.getProcessorIdentifier().getName());
System.out.println("Cores: " + cpu.getPhysicalProcessorCount());
System.out.println("Logical CPUs: " + cpu.getLogicalProcessorCount());
System.out.println("Max Freq: " + cpu.getMaxFreq() / 1_000_000 + " MHz");

// CPU load
double cpuLoad = cpu.getSystemCpuLoad(1000);
System.out.println("CPU Load: " + (cpuLoad * 100) + "%");

Memory Information

import oshi.SystemInfo;
import oshi.hardware.GlobalMemory;

SystemInfo si = new SystemInfo();
GlobalMemory memory = si.getHardware().getMemory();

long total = memory.getTotal();
long available = memory.getAvailable();
long used = total - available;

System.out.println("Total Memory: " + total / 1024 / 1024 + " MB");
System.out.println("Used Memory: " + used / 1024 / 1024 + " MB");
System.out.println("Available Memory: " + available / 1024 / 1024 + " MB");

Disk Information

import oshi.SystemInfo;
import oshi.hardware.HWDiskStore;

SystemInfo si = new SystemInfo();
List<HWDiskStore> disks = si.getHardware().getDiskStores();

for (HWDiskStore disk : disks) {
    System.out.println("Disk: " + disk.getName());
    System.out.println("  Model: " + disk.getModel());
    System.out.println("  Size: " + disk.getSize() / 1024 / 1024 / 1024 + " GB");
    System.out.println("  Reads: " + disk.getReads());
    System.out.println("  Writes: " + disk.getWrites());
}

Install with Tessl CLI

npx tessl i tessl/maven-com-github-oshi--oshi-core

docs

file-system.md

hardware.md

index.md

network.md

operating-system.md

process-management.md

system-info.md

tile.json