Struct amdgpu_sysfs::gpu_handle::GpuHandle
source · Expand description
A GpuHandle represents a handle over a single GPU device, as exposed in the Linux SysFS.
Fields
hw_monitors: Vec<HwMon>A collection of all HwMons bound to this GPU. They are used to expose real-time data.
Implementations
sourceimpl GpuHandle
impl GpuHandle
sourcepub fn new_from_path(sysfs_path: PathBuf) -> Result<Self, Error>
pub fn new_from_path(sysfs_path: PathBuf) -> Result<Self, Error>
Initializes a new GpuHandle from a given SysFS device path.
Normally, the path should look akin to /sys/class/drm/card0/device,
and it needs to at least contain a uevent file.
sourcepub fn get_driver(&self) -> &str
pub fn get_driver(&self) -> &str
Gets the kernel driver used.
sourcepub fn get_pci_id(&self) -> Option<(&str, &str)>
pub fn get_pci_id(&self) -> Option<(&str, &str)>
Gets the GPU’s PCI vendor and ID. This is the ID of your GPU chip, e.g. AMD Radeon RX 580.
sourcepub fn get_pci_subsys_id(&self) -> Option<(&str, &str)>
pub fn get_pci_subsys_id(&self) -> Option<(&str, &str)>
Gets the Card’s PCI vendor and ID. This is the ID of your card model, e.g. Sapphire RX 580 Pulse.
pub fn get_pci_slot_name(&self) -> Option<&str>
pub fn get_current_link_speed(&self) -> Result<String, Error>
pub fn get_current_link_width(&self) -> Result<String, Error>
pub fn get_max_link_speed(&self) -> Result<String, Error>
pub fn get_max_link_width(&self) -> Result<String, Error>
sourcepub fn get_total_vram(&self) -> Result<u64, Error>
pub fn get_total_vram(&self) -> Result<u64, Error>
Gets total VRAM size in bytes. May not be reported on some devices, such as integrated GPUs.
sourcepub fn get_used_vram(&self) -> Result<u64, Error>
pub fn get_used_vram(&self) -> Result<u64, Error>
Gets how much VRAM is currently used, in bytes. May not be reported on some devices, such as integrated GPUs.
sourcepub fn get_busy_percent(&self) -> Result<u8, Error>
pub fn get_busy_percent(&self) -> Result<u8, Error>
Returns the GPU busy percentage.
sourcepub fn get_vbios_version(&self) -> Result<String, Error>
pub fn get_vbios_version(&self) -> Result<String, Error>
Returns the GPU VBIOS version. Empty if the GPU doesn’t report one.
sourcepub fn get_power_force_performance_level(
&self
) -> Result<PerformanceLevel, Error>
pub fn get_power_force_performance_level(
&self
) -> Result<PerformanceLevel, Error>
Returns the currently forced performance level.
sourcepub fn set_power_force_performance_level(
&self,
level: PerformanceLevel
) -> Result<(), Error>
pub fn set_power_force_performance_level(
&self,
level: PerformanceLevel
) -> Result<(), Error>
Forces a given performance level.
sourcepub fn get_power_levels(
&self,
kind: PowerStateKind
) -> Result<(Vec<String>, u8), Error>
pub fn get_power_levels(
&self,
kind: PowerStateKind
) -> Result<(Vec<String>, u8), Error>
Retuns the list of power levels and index of the currently active level for a given kind of power state.
sourcepub fn set_enabled_power_levels(
&self,
kind: PowerStateKind,
levels: &[u8]
) -> Result<(), Error>
pub fn set_enabled_power_levels(
&self,
kind: PowerStateKind,
levels: &[u8]
) -> Result<(), Error>
Sets the enabled power levels for a power state kind to a given list of levels. This means that only the given power levels will be allowed.
Can only be used if power_force_performance_level is set to manual.