Class AbstractGraphicsCard
- All Implemented Interfaces:
GraphicsCard
- Direct Known Subclasses:
LinuxGraphicsCard, MacGraphicsCard
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractGraphicsCard(String name, String deviceId, String vendor, String versionInfo, long vram) Constructor for AbstractGraphicsCard -
Method Summary
Modifier and TypeMethodDescriptionOpens a newGpuStatssession for sampling dynamic GPU metrics.Retrieves the card's Device IDgetName()Retrieves the full name of the card.Retrieves the card's manufacturer/vendorRetrieves a list of version/revision data from the card.longgetVRam()Retrieves the Video RAM (VRAM) available on the GPUtoString()Returns a string representation of this graphics card including any available dynamic metrics.
-
Constructor Details
-
AbstractGraphicsCard
-
-
Method Details
-
getName
Description copied from interface:GraphicsCardRetrieves the full name of the card.- Specified by:
getNamein interfaceGraphicsCard- Returns:
- The name of the card.
-
getDeviceId
Description copied from interface:GraphicsCardRetrieves the card's Device ID- Specified by:
getDeviceIdin interfaceGraphicsCard- Returns:
- The Device ID of the card
-
getVendor
Description copied from interface:GraphicsCardRetrieves the card's manufacturer/vendor- Specified by:
getVendorin interfaceGraphicsCard- Returns:
- The vendor of the card as human-readable text if possible, or the Vendor ID (VID) otherwise
-
getVersionInfo
Description copied from interface:GraphicsCardRetrieves a list of version/revision data from the card. Users may need to further parse this list to identify specific GPU capabilities.- Specified by:
getVersionInfoin interfaceGraphicsCard- Returns:
- A comma-delimited list of version/revision data
-
getVRam
public long getVRam()Description copied from interface:GraphicsCardRetrieves the Video RAM (VRAM) available on the GPU- Specified by:
getVRamin interfaceGraphicsCard- Returns:
- Total number of bytes.
-
createStatsSession
Description copied from interface:GraphicsCardOpens a newGpuStatssession 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.
- Specified by:
createStatsSessionin interfaceGraphicsCard- Returns:
- a new, open
GpuStatssession
-
toString
Returns a string representation of this graphics card including any available dynamic metrics.Performance note: this method opens a native
GpuStatssession viacreateStatsSession(), samples all available metrics, then closes the session. On platforms with native GPU subscriptions (e.g. Apple Silicon via IOReport) this involves kernel-level IPC and should not be called in hot paths. Cache the result if repeated string representations are needed.Delta-based metric backends (
GpuStats.getGpuUtilization()andGpuStats.getPowerDraw()) may return -1 on the first call after a session is opened while they record the initial baseline. Backends that read instantaneous values (e.g. Linux sysfs and the macOS IOAccelerator fallback) can return a valid value on the first call. Use a persistentGpuStatssession with a polling loop for reliable delta values.
-