Interface GraphicsCard

All Known Implementing Classes:
AbstractGraphicsCard, LinuxGraphicsCard, MacGraphicsCard

@PublicApi @Immutable public interface GraphicsCard
Represents a graphics card (GPU) installed in the system.

Identity fields (getName(), getDeviceId(), getVendor(), getVersionInfo(), getVRam()) are static and safe to read at any time.

Live metrics (utilization, temperature, power, clocks, fan speed, VRAM used) are accessed through a GpuStats session obtained via createStatsSession(). For a single snapshot, use try-with-resources:

try (GpuStats stats = card.createStatsSession()) {
    double temp = stats.getTemperature();
    double power = stats.getPowerDraw();
}

For repeated polling, hold the session open across iterations to preserve internal delta state. See GpuStats for a full polling example and details on which metrics require priming.

  • Method Details

    • getName

      String getName()
      Retrieves the full name of the card.
      Returns:
      The name of the card.
    • getDeviceId

      String getDeviceId()
      Retrieves the card's Device ID
      Returns:
      The Device ID of the card
    • getVendor

      String getVendor()
      Retrieves the card's manufacturer/vendor
      Returns:
      The vendor of the card as human-readable text if possible, or the Vendor ID (VID) otherwise
    • getVersionInfo

      String getVersionInfo()
      Retrieves a list of version/revision data from the card. Users may need to further parse this list to identify specific GPU capabilities.
      Returns:
      A comma-delimited list of version/revision data
    • getVRam

      long getVRam()
      Retrieves the Video RAM (VRAM) available on the GPU
      Returns:
      Total number of bytes.
    • createStatsSession

      GpuStats createStatsSession()
      Opens a new GpuStats session for sampling dynamic GPU metrics. The caller is responsible for closing the session when done, preferably via try-with-resources.

      Never returns null and never throws. Platforms that do not support a native session return a no-op instance whose metric methods return sentinel values.

      Returns:
      a new, open GpuStats session