nvml_wrapper/structs/
device.rs

1#[cfg(target_os = "windows")]
2use crate::enum_wrappers::device::DriverModel;
3use crate::enum_wrappers::device::OperationMode;
4#[cfg(feature = "serde")]
5use serde_derive::{Deserialize, Serialize};
6
7/// Returned from `Device.auto_boosted_clocks_enabled()`
8#[derive(Debug, Clone, Eq, PartialEq, Hash)]
9#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
10pub struct AutoBoostClocksEnabledInfo {
11    /// Current state of auto boosted clocks for the `Device`
12    pub is_enabled: bool,
13    /// Default auto boosted clocks behavior for the `Device`
14    ///
15    /// The GPU will revert to this default when no applications are using the
16    /// GPU.
17    pub is_enabled_default: bool,
18}
19
20/// Returned from `Device.decoder_utilization()` and
21/// `Device.encoder_utilization()`.
22#[derive(Debug, Clone, Eq, PartialEq, Hash)]
23#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
24pub struct UtilizationInfo {
25    pub utilization: u32,
26    /// Sampling period in μs.
27    pub sampling_period: u32,
28}
29
30/// Returned from `Device.driver_model()`
31#[derive(Debug)]
32#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
33#[cfg(target_os = "windows")]
34pub struct DriverModelState {
35    pub current: DriverModel,
36    pub pending: DriverModel,
37}
38
39/// Returned from `Device.is_ecc_enabled()`
40#[derive(Debug, Clone, Eq, PartialEq, Hash)]
41#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
42pub struct EccModeState {
43    pub currently_enabled: bool,
44    pub pending_enabled: bool,
45}
46
47/// Returned from `Device.gpu_operation_mode()`
48#[derive(Debug)]
49#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
50pub struct OperationModeState {
51    pub current: OperationMode,
52    pub pending: OperationMode,
53}
54
55/// Returned from `Device.power_management_limit_constraints()`
56///
57/// Values are in milliwatts.
58#[derive(Debug, Clone, Eq, PartialEq, Hash)]
59#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
60pub struct PowerManagementConstraints {
61    pub min_limit: u32,
62    pub max_limit: u32,
63}
64
65/// Returned from `Device.encoder_stats()`
66#[derive(Debug, Clone, Eq, PartialEq, Hash)]
67#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
68pub struct EncoderStats {
69    /// The number of active encoder sessions.
70    pub session_count: u32,
71    /// The trailing average FPS of all active encoder sessions.
72    pub average_fps: u32,
73    /// The encode latency in μs.
74    pub average_latency: u32,
75}
76
77/// Returned from `Device.cuda_compute_capability()`
78#[derive(Debug, Clone, Eq, PartialEq, Hash)]
79#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
80pub struct CudaComputeCapability {
81    pub major: i32,
82    pub minor: i32,
83}
84
85/// Returned from `Device.retired_pages()`
86#[derive(Debug, Clone, Eq, PartialEq, Hash)]
87#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
88pub struct RetiredPage {
89    /// The hardware address of the page that was retired.
90    ///
91    /// Note that this does not match the virtual address used in CUDA but does
92    /// match the address information in XID 63.
93    pub address: u64,
94    /// The retirement timestamp.
95    pub timestamp: u64,
96}
97
98/// Populate this newtype with the constants `nvml_wrapper::sys_exports::field_id::*`.
99///
100/// Used in `FieldValue` and `Device.field_values_for()`.
101#[derive(Debug, Clone, Eq, PartialEq, Hash)]
102#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
103pub struct FieldId(pub u32);