mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-01-23 20:48:31 +03:00
Add rockchip temps
This commit is contained in:
parent
7fb8d9b050
commit
194ed61189
@ -123,6 +123,10 @@ def get_detector_temperature(
|
|||||||
if index < len(hailo_device_names):
|
if index < len(hailo_device_names):
|
||||||
device_name = hailo_device_names[index]
|
device_name = hailo_device_names[index]
|
||||||
return hailo_temps[device_name]
|
return hailo_temps[device_name]
|
||||||
|
elif detector_type == "rknn":
|
||||||
|
# Rockchip temperatures are handled by the GPU / NPU stats
|
||||||
|
# as there are not detector specific temperatures
|
||||||
|
pass
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
@ -417,12 +417,12 @@ def get_openvino_npu_stats() -> Optional[dict[str, str]]:
|
|||||||
else:
|
else:
|
||||||
usage = 0.0
|
usage = 0.0
|
||||||
|
|
||||||
return {"npu": f"{round(usage, 2)}", "mem": "-"}
|
return {"npu": f"{round(usage, 2)}", "mem": "-%"}
|
||||||
except (FileNotFoundError, PermissionError, ValueError):
|
except (FileNotFoundError, PermissionError, ValueError):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def get_rockchip_gpu_stats() -> Optional[dict[str, str]]:
|
def get_rockchip_gpu_stats() -> Optional[dict[str, str | float]]:
|
||||||
"""Get GPU stats using rk."""
|
"""Get GPU stats using rk."""
|
||||||
try:
|
try:
|
||||||
with open("/sys/kernel/debug/rkrga/load", "r") as f:
|
with open("/sys/kernel/debug/rkrga/load", "r") as f:
|
||||||
@ -440,7 +440,16 @@ def get_rockchip_gpu_stats() -> Optional[dict[str, str]]:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
average_load = f"{round(sum(load_values) / len(load_values), 2)}%"
|
average_load = f"{round(sum(load_values) / len(load_values), 2)}%"
|
||||||
return {"gpu": average_load, "mem": "-"}
|
stats: dict[str, str | float] = {"gpu": average_load, "mem": "-%"}
|
||||||
|
|
||||||
|
try:
|
||||||
|
with open("/sys/class/thermal/thermal_zone5/temp", "r") as f:
|
||||||
|
line = f.readline().strip()
|
||||||
|
stats["temp"] = round(int(line) / 1000, 1)
|
||||||
|
except (FileNotFoundError, OSError, ValueError):
|
||||||
|
pass
|
||||||
|
|
||||||
|
return stats
|
||||||
|
|
||||||
|
|
||||||
def get_rockchip_npu_stats() -> Optional[dict[str, float | str]]:
|
def get_rockchip_npu_stats() -> Optional[dict[str, float | str]]:
|
||||||
@ -463,7 +472,16 @@ def get_rockchip_npu_stats() -> Optional[dict[str, float | str]]:
|
|||||||
|
|
||||||
percentages = [int(load) for load in core_loads]
|
percentages = [int(load) for load in core_loads]
|
||||||
mean = round(sum(percentages) / len(percentages), 2)
|
mean = round(sum(percentages) / len(percentages), 2)
|
||||||
return {"npu": mean, "mem": "-"}
|
stats: dict[str, float | str] = {"npu": mean, "mem": "-%"}
|
||||||
|
|
||||||
|
try:
|
||||||
|
with open("/sys/class/thermal/thermal_zone6/temp", "r") as f:
|
||||||
|
line = f.readline().strip()
|
||||||
|
stats["temp"] = round(int(line) / 1000, 1)
|
||||||
|
except (FileNotFoundError, OSError, ValueError):
|
||||||
|
pass
|
||||||
|
|
||||||
|
return stats
|
||||||
|
|
||||||
|
|
||||||
def try_get_info(f, h, default="N/A"):
|
def try_get_info(f, h, default="N/A"):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user