mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
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:
parent
e32bd4ab15
commit
9b687d77ce
@ -176,6 +176,8 @@ async def set_gpu_stats(
|
|||||||
stats[nvidia_usage[i]["name"]] = {
|
stats[nvidia_usage[i]["name"]] = {
|
||||||
"gpu": str(round(float(nvidia_usage[i]["gpu"]), 2)) + "%",
|
"gpu": str(round(float(nvidia_usage[i]["gpu"]), 2)) + "%",
|
||||||
"mem": str(round(float(nvidia_usage[i]["mem"]), 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:
|
else:
|
||||||
|
@ -293,6 +293,8 @@ def get_nvidia_gpu_stats() -> dict[int, dict]:
|
|||||||
handle = nvml.nvmlDeviceGetHandleByIndex(i)
|
handle = nvml.nvmlDeviceGetHandleByIndex(i)
|
||||||
meminfo = try_get_info(nvml.nvmlDeviceGetMemoryInfo, handle)
|
meminfo = try_get_info(nvml.nvmlDeviceGetMemoryInfo, handle)
|
||||||
util = try_get_info(nvml.nvmlDeviceGetUtilizationRates, 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":
|
if util != "N/A":
|
||||||
gpu_util = util.gpu
|
gpu_util = util.gpu
|
||||||
else:
|
else:
|
||||||
@ -303,10 +305,22 @@ def get_nvidia_gpu_stats() -> dict[int, dict]:
|
|||||||
else:
|
else:
|
||||||
gpu_mem_util = -1
|
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] = {
|
results[i] = {
|
||||||
"name": nvml.nvmlDeviceGetName(handle),
|
"name": nvml.nvmlDeviceGetName(handle),
|
||||||
"gpu": gpu_util,
|
"gpu": gpu_util,
|
||||||
"mem": gpu_mem_util,
|
"mem": gpu_mem_util,
|
||||||
|
"enc": enc_util,
|
||||||
|
"dec": dec_util,
|
||||||
}
|
}
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
@ -301,12 +301,16 @@ export default function System() {
|
|||||||
<Tr>
|
<Tr>
|
||||||
<Th>GPU %</Th>
|
<Th>GPU %</Th>
|
||||||
<Th>Memory %</Th>
|
<Th>Memory %</Th>
|
||||||
|
{'dec' in gpu_usages[gpu] && (<Th>Decoder %</Th>)}
|
||||||
|
{'enc' in gpu_usages[gpu] && (<Th>Encoder %</Th>)}
|
||||||
</Tr>
|
</Tr>
|
||||||
</Thead>
|
</Thead>
|
||||||
<Tbody>
|
<Tbody>
|
||||||
<Tr>
|
<Tr>
|
||||||
<Td>{gpu_usages[gpu]['gpu']}</Td>
|
<Td>{gpu_usages[gpu]['gpu']}</Td>
|
||||||
<Td>{gpu_usages[gpu]['mem']}</Td>
|
<Td>{gpu_usages[gpu]['mem']}</Td>
|
||||||
|
{'dec' in gpu_usages[gpu] && (<Td>{gpu_usages[gpu]['dec']}</Td>)}
|
||||||
|
{'enc' in gpu_usages[gpu] && (<Td>{gpu_usages[gpu]['enc']}</Td>)}
|
||||||
</Tr>
|
</Tr>
|
||||||
</Tbody>
|
</Tbody>
|
||||||
</Table>
|
</Table>
|
||||||
|
Loading…
Reference in New Issue
Block a user