video['global'] can be empty resulting in a divide by zero (#16993)

* video['global'] can be empty resulting in a divide by zero

* formatting :(
This commit is contained in:
Chris Oelerich 2025-03-06 17:21:16 -05:00 committed by GitHub
parent 433da8ffce
commit f81bab8895
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -362,7 +362,7 @@ def get_intel_gpu_stats(sriov: bool) -> dict[str, str]:
if video_frame is not None:
video[key].append(float(video_frame))
if render["global"]:
if render["global"] and video["global"]:
results["gpu"] = (
f"{round(((sum(render['global']) / len(render['global'])) + (sum(video['global']) / len(video['global']))) / 2, 2)}%"
)