Add DriverVersion and CUDA Version to output (#8436)

This commit is contained in:
Alexey Kuzyashin 2020-11-19 19:52:47 +03:00 committed by GitHub
parent ee861fdeed
commit 8ad288bad4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

View File

@ -52,6 +52,8 @@ You'll need to escape the `\` within the `telegraf.conf` like this: `C:\\Program
- `clocks_current_sm` (integer, MHz)
- `clocks_current_memory` (integer, MHz)
- `clocks_current_video` (integer, MHz)
- `driver_version` (string)
- `cuda_version` (string)
### Sample Query

View File

@ -109,6 +109,8 @@ func (s *SMI) genTagsFields() []metric {
setTagIfUsed(tags, "uuid", gpu.UUID)
setTagIfUsed(tags, "compute_mode", gpu.ComputeMode)
setIfUsed("str", fields, "driver_version", s.DriverVersion)
setIfUsed("str", fields, "cuda_version", s.CUDAVersion)
setIfUsed("int", fields, "fan_speed", gpu.FanSpeed)
setIfUsed("int", fields, "memory_total", gpu.Memory.Total)
setIfUsed("int", fields, "memory_used", gpu.Memory.Used)
@ -169,12 +171,18 @@ func setIfUsed(t string, m map[string]interface{}, k, v string) {
m[k] = i
}
}
case "str":
if val != "" {
m[k] = val
}
}
}
// SMI defines the structure for the output of _nvidia-smi -q -x_.
type SMI struct {
GPU GPU `xml:"gpu"`
GPU GPU `xml:"gpu"`
DriverVersion string `xml:"driver_version"`
CUDAVersion string `xml:"cuda_version"`
}
// GPU defines the structure of the GPU portion of the smi output.

View File

@ -69,6 +69,8 @@ func TestGatherValidXML(t *testing.T) {
"clocks_current_memory": 405,
"clocks_current_sm": 300,
"clocks_current_video": 540,
"cuda_version": "10.1",
"driver_version": "418.43",
"encoder_stats_average_fps": 0,
"encoder_stats_average_latency": 0,
"encoder_stats_session_count": 0,
@ -109,6 +111,8 @@ func TestGatherValidXML(t *testing.T) {
"clocks_current_memory": 405,
"clocks_current_sm": 139,
"clocks_current_video": 544,
"cuda_version": "10.1",
"driver_version": "418.43",
"encoder_stats_average_fps": 0,
"encoder_stats_average_latency": 0,
"encoder_stats_session_count": 0,