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 async fn new_from_path(sysfs_path: PathBuf) -> Result<Self, GpuHandleError>
pub async fn new_from_path(sysfs_path: PathBuf) -> Result<Self, GpuHandleError>
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 async fn get_driver(&self) -> &str
pub async 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 async fn get_current_link_speed(&self) -> Option<String>
pub async fn get_current_link_width(&self) -> Option<String>
pub async fn get_max_link_speed(&self) -> Option<String>
pub async fn get_max_link_width(&self) -> Option<String>
sourcepub async fn get_total_vram(&self) -> Option<u64>
pub async fn get_total_vram(&self) -> Option<u64>
Gets total VRAM size in bytes. May not be reported on some devices, such as integrated GPUs.
sourcepub async fn get_used_vram(&self) -> Option<u64>
pub async fn get_used_vram(&self) -> Option<u64>
Gets how much VRAM is currently used, in bytes. May not be reported on some devices, such as integrated GPUs.
sourcepub async fn get_busy_percent(&self) -> Option<u8>
pub async fn get_busy_percent(&self) -> Option<u8>
Returns the GPU busy percentage.
sourcepub async fn get_vbios_version(&self) -> Option<String>
pub async fn get_vbios_version(&self) -> Option<String>
Returns the GPU VBIOS version. Empty if the GPU doesn’t report one.
sourcepub async fn get_power_force_performance_level(
&self
) -> Option<PerformanceLevel>
pub async fn get_power_force_performance_level(
&self
) -> Option<PerformanceLevel>
Returns the currently forced performance level.
sourcepub async fn set_power_force_performance_level(
&self,
level: PerformanceLevel
) -> Result<(), GpuHandleError>
pub async fn set_power_force_performance_level(
&self,
level: PerformanceLevel
) -> Result<(), GpuHandleError>
Forces a given performance level.
sourcepub async fn get_power_levels(
&self,
kind: PowerStateKind
) -> Option<(Vec<String>, u8)>
pub async fn get_power_levels(
&self,
kind: PowerStateKind
) -> Option<(Vec<String>, u8)>
Retuns the list of power levels and index of the currently active level for a given kind of power state.
sourcepub async fn set_enabled_power_levels(
&self,
kind: PowerStateKind,
levels: &[u8]
) -> Result<(), GpuHandleError>
pub async fn set_enabled_power_levels(
&self,
kind: PowerStateKind,
levels: &[u8]
) -> Result<(), GpuHandleError>
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
.
Trait Implementations
sourceimpl SysFS for GpuHandle
impl SysFS for GpuHandle
fn get_path(&self) -> &Path
sourcefn read_file<'life0, 'life1, 'async_trait>(
&'life0 self,
file: &'life1 str
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
fn read_file<'life0, 'life1, 'async_trait>(
&'life0 self,
file: &'life1 str
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
Reads the content of a file in the SysFS.
sourcefn write_file<'life0, 'life1, 'async_trait, C>(
&'life0 self,
file: &'life1 str,
contents: C
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
C: 'async_trait + AsRef<[u8]> + Send,
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
fn write_file<'life0, 'life1, 'async_trait, C>(
&'life0 self,
file: &'life1 str,
contents: C
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
C: 'async_trait + AsRef<[u8]> + Send,
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
Write to a file in the SysFS.
Auto Trait Implementations
impl RefUnwindSafe for GpuHandle
impl Send for GpuHandle
impl Sync for GpuHandle
impl Unpin for GpuHandle
impl UnwindSafe for GpuHandle
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more