diff --git a/frigate/stats.py b/frigate/stats.py index 41ba2c367..8f8d03ed4 100644 --- a/frigate/stats.py +++ b/frigate/stats.py @@ -176,6 +176,8 @@ async def set_gpu_stats( stats[nvidia_usage[i]["name"]] = { "gpu": str(round(float(nvidia_usage[i]["gpu"]), 2)) + "%", "mem": str(round(float(nvidia_usage[i]["mem"]), 2)) + "%", + "enc": str(round(float(nvidia_usage[i]["enc"]), 2)) + "%", + "dec": str(round(float(nvidia_usage[i]["dec"]), 2)) + "%", } else: diff --git a/frigate/util/services.py b/frigate/util/services.py index 2ffddcacf..94946434b 100644 --- a/frigate/util/services.py +++ b/frigate/util/services.py @@ -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 diff --git a/web/src/routes/System.jsx b/web/src/routes/System.jsx index 602522924..0074763fa 100644 --- a/web/src/routes/System.jsx +++ b/web/src/routes/System.jsx @@ -301,12 +301,16 @@ export default function System() { GPU % Memory % + {'dec' in gpu_usages[gpu] && (Decoder %)} + {'enc' in gpu_usages[gpu] && (Encoder %)} {gpu_usages[gpu]['gpu']} {gpu_usages[gpu]['mem']} + {'dec' in gpu_usages[gpu] && ({gpu_usages[gpu]['dec']})} + {'enc' in gpu_usages[gpu] && ({gpu_usages[gpu]['enc']})}