mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-05 02:35:22 +03:00
black...black...black...
This commit is contained in:
parent
a338f74ecd
commit
4eb7b31759
@ -916,7 +916,7 @@ def get_intel_gpu_stats() -> dict[str, str]:
|
||||
return results
|
||||
|
||||
|
||||
def try_get_info(f, h, default='N/A'):
|
||||
def try_get_info(f, h, default="N/A"):
|
||||
try:
|
||||
v = f(h)
|
||||
except nvml.NVMLError_NotSupported:
|
||||
@ -924,7 +924,6 @@ def try_get_info(f, h, default='N/A'):
|
||||
return v
|
||||
|
||||
|
||||
|
||||
def get_nvidia_gpu_stats() -> dict[str, str]:
|
||||
nvml.nvmlInit()
|
||||
deviceCount = nvml.nvmlDeviceGetCount()
|
||||
@ -933,20 +932,19 @@ def get_nvidia_gpu_stats() -> dict[str, str]:
|
||||
handle = nvml.nvmlDeviceGetHandleByIndex(i)
|
||||
meminfo = nvml.nvmlDeviceGetMemoryInfo(handle)
|
||||
util = try_get_info(nvml.nvmlDeviceGetUtilizationRates, handle)
|
||||
if util != 'N/A':
|
||||
if util != "N/A":
|
||||
gpu_util = util.gpu
|
||||
else:
|
||||
gpu_util = 0
|
||||
results[i] = {
|
||||
"name": nvml.nvmlDeviceGetName(handle),
|
||||
"gpu": gpu_util,
|
||||
"mem": meminfo.used / meminfo.total * 100
|
||||
"mem": meminfo.used / meminfo.total * 100,
|
||||
}
|
||||
|
||||
return results
|
||||
|
||||
|
||||
|
||||
def ffprobe_stream(path: str) -> sp.CompletedProcess:
|
||||
"""Run ffprobe on stream."""
|
||||
clean_path = escape_special_characters(path)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user