pub struct EventSet(/* private fields */);Implementations§
Source§impl EventSet
impl EventSet
Sourcepub fn register_device(
&self,
device: Device,
event_types: EventTypes,
) -> Result<()>
pub fn register_device( &self, device: Device, event_types: EventTypes, ) -> Result<()>
Starts recording the requested events for the specified device.
For Fermi or newer fully supported devices. ECC events are available only on ECC-enabled devices; power-capping events are available only on devices with power management support.
For Linux only.
All events that occurred before this call are not recorded.
Use EventSet::wait to observe recorded events.
If NVML reports Status::Unknown, the event set is in an undefined
state and must be freed.
If NVML reports Status::NotSupported, the event set can still be
used, but none of the requested event types are registered.
§Errors
Returns an error if the device is inaccessible, if NVML rejects the event set or event mask, if the platform or requested event types are not supported, if NVML has not been initialized, or if NVML reports an unexpected failure.
Sourcepub fn wait(&self, timeout_ms: u32) -> Result<EventData>
pub fn wait(&self, timeout_ms: u32) -> Result<EventData>
Waits for and returns the next event.
For Fermi or newer fully supported devices.
If events are ready when this is called, it returns immediately.
If no events are ready, it sleeps until an event arrives or timeout_ms expires.
In some conditions, such as an interrupt, this can return before the timeout expires.
On Windows, after an Xid error, this method returns the most recent Xid error type seen by the system. If multiple Xid errors are generated before this wait call is made, the last seen Xid error type is returned for all Xid error events.
On Linux, every Xid error event returns the associated event data and other information if applicable.
In MIG mode, if a device handle is provided, NVML reports events for all available instances only when the caller has appropriate privileges. Without those privileges, only events affecting all instances, namely the whole device, are reported.
This does not currently support per-instance event reporting using MIG device handles.
§Errors
Returns an error if a registered GPU is inaccessible, if NVML rejects the
event-data output, if no event arrives before timeout_ms or the wait is
interrupted, if NVML has not been initialized, or if NVML reports an
unexpected failure.