diff --git a/examples/link-speed.rs b/examples/link-speed.rs new file mode 100644 index 0000000..b2c622a --- /dev/null +++ b/examples/link-speed.rs @@ -0,0 +1,16 @@ +use amdgpu_sysfs::gpu_handle::GpuHandle; +use std::path::PathBuf; + +fn main() { + let sysfs_path = PathBuf::from("/sys/class/drm/card0/device"); + let gpu_handle = GpuHandle::new_from_path(sysfs_path).unwrap(); + + println!("Cur: {}x{}", + gpu_handle.get_current_link_speed().unwrap(), + gpu_handle.get_current_link_width().unwrap(), + ); + println!("Max: {}x{}", + gpu_handle.get_max_link_speed().unwrap(), + gpu_handle.get_max_link_width().unwrap(), + ); +}