summaryrefslogtreecommitdiffstats
path: root/src/go/plugin/go.d/modules/nvidia_smi/gpu_info.go
blob: 506d36f6eefe75d672fe5e7478685200f40d54e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// SPDX-License-Identifier: GPL-3.0-or-later

package nvidia_smi

type gpusInfo struct {
	GPUs []gpuInfo `xml:"gpu"`
}

type (
	gpuInfo struct {
		ID                  string `xml:"id,attr"`
		ProductName         string `xml:"product_name"`
		ProductBrand        string `xml:"product_brand"`
		ProductArchitecture string `xml:"product_architecture"`
		UUID                string `xml:"uuid"`
		FanSpeed            string `xml:"fan_speed"`
		PerformanceState    string `xml:"performance_state"`
		MIGMode             struct {
			CurrentMIG string `xml:"current_mig"`
		} `xml:"mig_mode"`
		MIGDevices struct {
			MIGDevice []gpuMIGDeviceInfo `xml:"mig_device"`
		} `xml:"mig_devices"`
		PCI struct {
			TxUtil         string `xml:"tx_util"`
			RxUtil         string `xml:"rx_util"`
			PCIGPULinkInfo struct {
				PCIEGen struct {
					MaxLinkGen string `xml:"max_link_gen"`
				} `xml:"pcie_gen"`
				LinkWidths struct {
					MaxLinkWidth string `xml:"max_link_width"`
				} `xml:"link_widths"`
			} `xml:"pci_gpu_link_info"`
		} `xml:"pci"`
		Utilization struct {
			GpuUtil     string `xml:"gpu_util"`
			MemoryUtil  string `xml:"memory_util"`
			EncoderUtil string `xml:"encoder_util"`
			DecoderUtil string `xml:"decoder_util"`
		} `xml:"utilization"`
		FBMemoryUsage struct {
			Total    string `xml:"total"`
			Reserved string `xml:"reserved"`
			Used     string `xml:"used"`
			Free     string `xml:"free"`
		} `xml:"fb_memory_usage"`
		Bar1MemoryUsage struct {
			Total string `xml:"total"`
			Used  string `xml:"used"`
			Free  string `xml:"free"`
		} `xml:"bar1_memory_usage"`
		Temperature struct {
			GpuTemp                string `xml:"gpu_temp"`
			GpuTempMaxThreshold    string `xml:"gpu_temp_max_threshold"`
			GpuTempSlowThreshold   string `xml:"gpu_temp_slow_threshold"`
			GpuTempMaxGpuThreshold string `xml:"gpu_temp_max_gpu_threshold"`
			GpuTargetTemperature   string `xml:"gpu_target_temperature"`
			MemoryTemp             string `xml:"memory_temp"`
			GpuTempMaxMemThreshold string `xml:"gpu_temp_max_mem_threshold"`
		} `xml:"temperature"`
		Clocks struct {
			GraphicsClock string `xml:"graphics_clock"`
			SmClock       string `xml:"sm_clock"`
			MemClock      string `xml:"mem_clock"`
			VideoClock    string `xml:"video_clock"`
		} `xml:"clocks"`
		PowerReadings    *gpuPowerReadings `xml:"power_readings"`
		GPUPowerReadings *gpuPowerReadings `xml:"gpu_power_readings"`
		Voltage          struct {
			GraphicsVolt string `xml:"graphics_volt"`
		} `xml:"voltage"`
		Processes struct {
			ProcessInfo []struct {
				PID         string `xml:"pid"`
				ProcessName string `xml:"process_name"`
				UsedMemory  string `xml:"used_memory"`
			} `sml:"process_info"`
		} `xml:"processes"`
	}
	gpuPowerReadings struct {
		//PowerState         string `xml:"power_state"`
		//PowerManagement    string `xml:"power_management"`
		PowerDraw string `xml:"power_draw"`
		//PowerLimit         string `xml:"power_limit"`
		//DefaultPowerLimit  string `xml:"default_power_limit"`
		//EnforcedPowerLimit string `xml:"enforced_power_limit"`
		//MinPowerLimit      string `xml:"min_power_limit"`
		//MaxPowerLimit      string `xml:"max_power_limit"`
	}

	gpuMIGDeviceInfo struct {
		Index             string `xml:"index"`
		GPUInstanceID     string `xml:"gpu_instance_id"`
		ComputeInstanceID string `xml:"compute_instance_id"`
		DeviceAttributes  struct {
			Shared struct {
				MultiprocessorCount string `xml:"multiprocessor_count"`
				CopyEngineCount     string `xml:"copy_engine_count"`
				EncoderCount        string `xml:"encoder_count"`
				DecoderCount        string `xml:"decoder_count"`
				OFACount            string `xml:"ofa_count"`
				JPGCount            string `xml:"jpg_count"`
			} `xml:"shared"`
		} `xml:"device_attributes"`
		ECCErrorCount struct {
			VolatileCount struct {
				SRAMUncorrectable string `xml:"sram_uncorrectable"`
			} `xml:"volatile_count"`
		} `xml:"ecc_error_count"`
		FBMemoryUsage struct {
			Free     string `xml:"free"`
			Used     string `xml:"used"`
			Reserved string `xml:"reserved"`
		} `xml:"fb_memory_usage"`
		BAR1MemoryUsage struct {
			Free string `xml:"free"`
			Used string `xml:"used"`
		} `xml:"bar1_memory_usage"`
	}
)