forked from Github/frigate
Add support for nvidia decoder and encoder utilization stats (#8150)
* Add encoder and decoder stats to nvidia hwaccel stats * Fix * Fix
This commit is contained in:
@@ -293,6 +293,8 @@ def get_nvidia_gpu_stats() -> dict[int, dict]:
|
||||
handle = nvml.nvmlDeviceGetHandleByIndex(i)
|
||||
meminfo = try_get_info(nvml.nvmlDeviceGetMemoryInfo, handle)
|
||||
util = try_get_info(nvml.nvmlDeviceGetUtilizationRates, handle)
|
||||
enc = try_get_info(nvml.nvmlDeviceGetEncoderUtilization, handle)
|
||||
dec = try_get_info(nvml.nvmlDeviceGetDecoderUtilization, handle)
|
||||
if util != "N/A":
|
||||
gpu_util = util.gpu
|
||||
else:
|
||||
@@ -303,10 +305,22 @@ def get_nvidia_gpu_stats() -> dict[int, dict]:
|
||||
else:
|
||||
gpu_mem_util = -1
|
||||
|
||||
if enc != "N/A":
|
||||
enc_util = enc[0]
|
||||
else:
|
||||
enc_util = -1
|
||||
|
||||
if dec != "N/A":
|
||||
dec_util = dec[0]
|
||||
else:
|
||||
dec_util = -1
|
||||
|
||||
results[i] = {
|
||||
"name": nvml.nvmlDeviceGetName(handle),
|
||||
"gpu": gpu_util,
|
||||
"mem": gpu_mem_util,
|
||||
"enc": enc_util,
|
||||
"dec": dec_util,
|
||||
}
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user