pub struct GpmSample<'nvml> { /* private fields */ }Expand description
Handle to a GPM (GPU Performance Monitoring) sample.
GPM enables collecting fine-grained GPU performance metrics (SM occupancy,
tensor utilization, PCIe/NVLink bandwidth, etc.) on Hopper+ GPUs. Metrics
are computed by taking two time-separated samples and comparing them via
gpm_metrics_get.
Operations on a sample are not thread-safe. It does not, therefore,
implement Sync.
You can obtain a GpmSample via crate::Device::gpm_sample() or
crate::Device::gpm_mig_sample().
Lifetimes are used to enforce that each GpmSample instance cannot be used
after the Nvml instance it was obtained from is dropped.
Implementations§
Source§impl<'nvml> GpmSample<'nvml>
impl<'nvml> GpmSample<'nvml>
Sourcepub fn free(self) -> Result<(), NvmlError>
pub fn free(self) -> Result<(), NvmlError>
Use this to free the sample if you care about handling potential errors
(the Drop implementation ignores errors!).
§Errors
Uninitialized, if the library has not been successfully initializedUnknown, on any unexpected error
Sourcepub unsafe fn handle(&self) -> nvmlGpmSample_t
pub unsafe fn handle(&self) -> nvmlGpmSample_t
Get the raw sample handle.
§Safety
This is unsafe to prevent it from being used without care. In
particular, you must avoid creating a new GpmSample from this handle
and allowing both this GpmSample and the newly created one to drop
(which would result in a double-free).
Trait Implementations§
Source§impl<'nvml> Drop for GpmSample<'nvml>
This Drop implementation ignores errors! Use the .free() method on
the GpmSample struct if you care about handling them.
impl<'nvml> Drop for GpmSample<'nvml>
This Drop implementation ignores errors! Use the .free() method on
the GpmSample struct if you care about handling them.