Add video codec stats to nvidia-smi (#7646)

This commit is contained in:
Xinyang Chen 2020-06-09 01:00:36 +08:00 committed by GitHub
parent 62302a0f37
commit fd59d55499
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 2 deletions

View File

@ -38,6 +38,8 @@ You'll need to escape the `\` within the `telegraf.conf` like this: `C:\\Program
- `temperature_gpu` (integer, degrees C)
- `utilization_gpu` (integer, percentage)
- `utilization_memory` (integer, percentage)
- `utilization_encoder` (integer, percentage)
- `utilization_decoder` (integer, percentage)
- `pcie_link_gen_current` (integer)
- `pcie_link_width_current` (integer)
- `encoder_stats_session_count` (integer)

View File

@ -116,11 +116,16 @@ func (s *SMI) genTagsFields() []metric {
setIfUsed("int", fields, "temperature_gpu", gpu.Temp.GPUTemp)
setIfUsed("int", fields, "utilization_gpu", gpu.Utilization.GPU)
setIfUsed("int", fields, "utilization_memory", gpu.Utilization.Memory)
setIfUsed("int", fields, "utilization_encoder", gpu.Utilization.Encoder)
setIfUsed("int", fields, "utilization_decoder", gpu.Utilization.Decoder)
setIfUsed("int", fields, "pcie_link_gen_current", gpu.PCI.LinkInfo.PCIEGen.CurrentLinkGen)
setIfUsed("int", fields, "pcie_link_width_current", gpu.PCI.LinkInfo.LinkWidth.CurrentLinkWidth)
setIfUsed("int", fields, "encoder_stats_session_count", gpu.Encoder.SessionCount)
setIfUsed("int", fields, "encoder_stats_average_fps", gpu.Encoder.AverageFPS)
setIfUsed("int", fields, "encoder_stats_average_latency", gpu.Encoder.AverageLatency)
setIfUsed("int", fields, "fbc_stats_session_count", gpu.FBC.SessionCount)
setIfUsed("int", fields, "fbc_stats_average_fps", gpu.FBC.AverageFPS)
setIfUsed("int", fields, "fbc_stats_average_latency", gpu.FBC.AverageLatency)
setIfUsed("int", fields, "clocks_current_graphics", gpu.Clocks.Graphics)
setIfUsed("int", fields, "clocks_current_sm", gpu.Clocks.SM)
setIfUsed("int", fields, "clocks_current_memory", gpu.Clocks.Memory)
@ -185,6 +190,7 @@ type GPU []struct {
Power PowerReadings `xml:"power_readings"`
PCI PCI `xml:"pci"`
Encoder EncoderStats `xml:"encoder_stats"`
FBC FBCStats `xml:"fbc_stats"`
Clocks ClockStats `xml:"clocks"`
}
@ -202,8 +208,10 @@ type TempStats struct {
// UtilizationStats defines the structure of the utilization portion of the smi output.
type UtilizationStats struct {
GPU string `xml:"gpu_util"` // int
Memory string `xml:"memory_util"` // int
GPU string `xml:"gpu_util"` // int
Memory string `xml:"memory_util"` // int
Encoder string `xml:"encoder_util"` // int
Decoder string `xml:"decoder_util"` // int
}
// PowerReadings defines the structure of the power_readings portion of the smi output.
@ -230,6 +238,13 @@ type EncoderStats struct {
AverageLatency string `xml:"average_latency"` // int
}
// FBCStats defines the structure of the fbc_stats portion of the smi output.
type FBCStats struct {
SessionCount string `xml:"session_count"` // int
AverageFPS string `xml:"average_fps"` // int
AverageLatency string `xml:"average_latency"` // int
}
// ClockStats defines the structure of the clocks portion of the smi output.
type ClockStats struct {
Graphics string `xml:"graphics_clock"` // int

View File

@ -72,6 +72,9 @@ func TestGatherValidXML(t *testing.T) {
"encoder_stats_average_fps": 0,
"encoder_stats_average_latency": 0,
"encoder_stats_session_count": 0,
"fbc_stats_average_fps": 0,
"fbc_stats_average_latency": 0,
"fbc_stats_session_count": 0,
"fan_speed": 0,
"memory_free": 5912,
"memory_total": 5912,
@ -82,6 +85,8 @@ func TestGatherValidXML(t *testing.T) {
"temperature_gpu": 40,
"utilization_gpu": 0,
"utilization_memory": 1,
"utilization_encoder": 0,
"utilization_decoder": 0,
},
time.Unix(0, 0)),
},
@ -107,6 +112,9 @@ func TestGatherValidXML(t *testing.T) {
"encoder_stats_average_fps": 0,
"encoder_stats_average_latency": 0,
"encoder_stats_session_count": 0,
"fbc_stats_average_fps": 0,
"fbc_stats_average_latency": 0,
"fbc_stats_session_count": 0,
"fan_speed": 34,
"memory_free": 1998,
"memory_total": 1998,
@ -116,6 +124,8 @@ func TestGatherValidXML(t *testing.T) {
"temperature_gpu": 33,
"utilization_gpu": 0,
"utilization_memory": 3,
"utilization_encoder": 0,
"utilization_decoder": 0,
},
time.Unix(0, 0)),
},