| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | package nvidia_smi |
| 4 | |
| 5 | type gpusInfo struct { |
| 6 | GPUs []gpuInfo `xml:"gpu"` |
| 7 | } |
| 8 | |
| 9 | type ( |
| 10 | gpuInfo struct { |
| 11 | ID string `xml:"id,attr"` |
| 12 | ProductName string `xml:"product_name"` |
| 13 | ProductBrand string `xml:"product_brand"` |
| 14 | ProductArchitecture string `xml:"product_architecture"` |
| 15 | UUID string `xml:"uuid"` |
| 16 | FanSpeed string `xml:"fan_speed"` |
| 17 | PerformanceState string `xml:"performance_state"` |
| 18 | MIGMode struct { |
| 19 | CurrentMIG string `xml:"current_mig"` |
| 20 | } `xml:"mig_mode"` |
| 21 | MIGDevices struct { |
| 22 | MIGDevice []gpuMIGDeviceInfo `xml:"mig_device"` |
| 23 | } `xml:"mig_devices"` |
| 24 | PCI struct { |
| 25 | TxUtil string `xml:"tx_util"` |
| 26 | RxUtil string `xml:"rx_util"` |
| 27 | PCIGPULinkInfo struct { |
| 28 | PCIEGen struct { |
| 29 | MaxLinkGen string `xml:"max_link_gen"` |
| 30 | } `xml:"pcie_gen"` |
| 31 | LinkWidths struct { |
| 32 | MaxLinkWidth string `xml:"max_link_width"` |
| 33 | } `xml:"link_widths"` |
| 34 | } `xml:"pci_gpu_link_info"` |
| 35 | } `xml:"pci"` |
| 36 | Utilization struct { |
| 37 | GpuUtil string `xml:"gpu_util"` |
| 38 | MemoryUtil string `xml:"memory_util"` |
| 39 | EncoderUtil string `xml:"encoder_util"` |
| 40 | DecoderUtil string `xml:"decoder_util"` |
| 41 | } `xml:"utilization"` |
| 42 | FBMemoryUsage struct { |
| 43 | Total string `xml:"total"` |
| 44 | Reserved string `xml:"reserved"` |
| 45 | Used string `xml:"used"` |
| 46 | Free string `xml:"free"` |
| 47 | } `xml:"fb_memory_usage"` |
| 48 | Bar1MemoryUsage struct { |
| 49 | Total string `xml:"total"` |
| 50 | Used string `xml:"used"` |
| 51 | Free string `xml:"free"` |
| 52 | } `xml:"bar1_memory_usage"` |
| 53 | Temperature struct { |
| 54 | GpuTemp string `xml:"gpu_temp"` |
| 55 | GpuTempMaxThreshold string `xml:"gpu_temp_max_threshold"` |
| 56 | GpuTempSlowThreshold string `xml:"gpu_temp_slow_threshold"` |
| 57 | GpuTempMaxGpuThreshold string `xml:"gpu_temp_max_gpu_threshold"` |
| 58 | GpuTargetTemperature string `xml:"gpu_target_temperature"` |
| 59 | MemoryTemp string `xml:"memory_temp"` |
| 60 | GpuTempMaxMemThreshold string `xml:"gpu_temp_max_mem_threshold"` |
| 61 | } `xml:"temperature"` |
| 62 | Clocks struct { |
| 63 | GraphicsClock string `xml:"graphics_clock"` |
| 64 | SmClock string `xml:"sm_clock"` |
| 65 | MemClock string `xml:"mem_clock"` |
| 66 | VideoClock string `xml:"video_clock"` |
| 67 | } `xml:"clocks"` |
| 68 | PowerReadings *gpuPowerReadings `xml:"power_readings"` |
| 69 | GPUPowerReadings *gpuPowerReadings `xml:"gpu_power_readings"` |
| 70 | Voltage struct { |
| 71 | GraphicsVolt string `xml:"graphics_volt"` |
| 72 | } `xml:"voltage"` |
| 73 | Processes struct { |
| 74 | ProcessInfo []struct { |
| 75 | PID string `xml:"pid"` |
| 76 | ProcessName string `xml:"process_name"` |
| 77 | UsedMemory string `xml:"used_memory"` |
| 78 | } `sml:"process_info"` |
| 79 | } `xml:"processes"` |
| 80 | } |
| 81 | gpuPowerReadings struct { |
| 82 | //PowerState string `xml:"power_state"` |
| 83 | //PowerManagement string `xml:"power_management"` |
| 84 | PowerDraw *string `xml:"power_draw"` |
| 85 | AveragePowerDraw *string `xml:"average_power_draw"` |
| 86 | InstantPowerDraw *string `xml:"instant_power_draw"` |
| 87 | //PowerLimit string `xml:"power_limit"` |
| 88 | //DefaultPowerLimit string `xml:"default_power_limit"` |
| 89 | //EnforcedPowerLimit string `xml:"enforced_power_limit"` |
| 90 | //MinPowerLimit string `xml:"min_power_limit"` |
| 91 | //MaxPowerLimit string `xml:"max_power_limit"` |
| 92 | } |
| 93 | |
| 94 | gpuMIGDeviceInfo struct { |
| 95 | Index string `xml:"index"` |
| 96 | GPUInstanceID string `xml:"gpu_instance_id"` |
| 97 | ComputeInstanceID string `xml:"compute_instance_id"` |
| 98 | DeviceAttributes struct { |
| 99 | Shared struct { |
| 100 | MultiprocessorCount string `xml:"multiprocessor_count"` |
| 101 | CopyEngineCount string `xml:"copy_engine_count"` |
| 102 | EncoderCount string `xml:"encoder_count"` |
| 103 | DecoderCount string `xml:"decoder_count"` |
| 104 | OFACount string `xml:"ofa_count"` |
| 105 | JPGCount string `xml:"jpg_count"` |
| 106 | } `xml:"shared"` |
| 107 | } `xml:"device_attributes"` |
| 108 | ECCErrorCount struct { |
| 109 | VolatileCount struct { |
| 110 | SRAMUncorrectable string `xml:"sram_uncorrectable"` |
| 111 | } `xml:"volatile_count"` |
| 112 | } `xml:"ecc_error_count"` |
| 113 | FBMemoryUsage struct { |
| 114 | Free string `xml:"free"` |
| 115 | Used string `xml:"used"` |
| 116 | Reserved string `xml:"reserved"` |
| 117 | } `xml:"fb_memory_usage"` |
| 118 | BAR1MemoryUsage struct { |
| 119 | Free string `xml:"free"` |
| 120 | Used string `xml:"used"` |
| 121 | } `xml:"bar1_memory_usage"` |
| 122 | } |
| 123 | ) |