Struct libdrm_amdgpu_sys::AMDGPU::ThrottleStatus
source · pub struct ThrottleStatus(/* private fields */);
Implementations§
source§impl ThrottleStatus
impl ThrottleStatus
pub fn new(val: u64) -> Self
pub fn check_throttler(&self, thr: ThrottlerBit) -> bool
sourcepub fn get_all_throttler(&self) -> Vec<ThrottlerBit>
pub fn get_all_throttler(&self) -> Vec<ThrottlerBit>
Examples found in repository?
examples/gpu_metrics.rs (line 24)
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
fn main() {
let device_path = std::env::var("AMDGPU_PATH").unwrap_or("/dev/dri/renderD128".to_string());
let (amdgpu_dev, _, _) = {
use std::os::fd::IntoRawFd;
let f = File::open(device_path).unwrap();
AMDGPU::DeviceHandle::init(f.into_raw_fd()).unwrap()
};
let path = amdgpu_dev.get_sysfs_path().unwrap();
if let Ok(metrics) = amdgpu_dev.get_gpu_metrics_from_sysfs_path(&path) {
println!("{:#?}", metrics);
if let Some(socket_power) = metrics.get_average_socket_power() {
println!("Average Socket Power: {socket_power} W");
}
if let Some(thr) = metrics.get_throttle_status_info() {
println!("Throttle Status: {:?}", thr.get_all_throttler());
}
} else {
let ext_info = amdgpu_dev.device_info().unwrap();
let asic_name = ext_info.get_asic_name();
println!("{asic_name} dose not support GPU metrics.");
println!("Vega12 (dGPU) or later, Renoir (APU) or later supports GPU metrics.")
}
}
pub fn get_all_throttler_type(&self) -> Vec<ThrottlerType>
pub fn get_all_throttler_type_from_slice( thrs: &[ThrottlerBit] ) -> Vec<ThrottlerType>
Trait Implementations§
source§impl Clone for ThrottleStatus
impl Clone for ThrottleStatus
source§fn clone(&self) -> ThrottleStatus
fn clone(&self) -> ThrottleStatus
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ThrottleStatus
impl Debug for ThrottleStatus
impl Copy for ThrottleStatus
Auto Trait Implementations§
impl Freeze for ThrottleStatus
impl RefUnwindSafe for ThrottleStatus
impl Send for ThrottleStatus
impl Sync for ThrottleStatus
impl Unpin for ThrottleStatus
impl UnwindSafe for ThrottleStatus
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more