From 5a0a9bc7b1225bc25e61f32572ebdf03500041b8 Mon Sep 17 00:00:00 2001 From: Sergey Krashevich Date: Thu, 18 May 2023 09:05:34 +0300 Subject: [PATCH] Add network bandwidth usage to system table in web UI and improve regex in get_bandwidth_stats function to include frigate detector processes --- frigate/util.py | 2 +- web/src/routes/System.jsx | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/frigate/util.py b/frigate/util.py index b2e7977b9..d37d89661 100755 --- a/frigate/util.py +++ b/frigate/util.py @@ -864,7 +864,7 @@ def get_bandwidth_stats() -> dict[str, dict]: for line in lines: stats = list(filter(lambda a: a != "", line.strip().split("\t"))) try: - if re.search("(^ffmpeg|\/go2rtc)/([0-9]+)/", stats[0]): + if re.search("(^ffmpeg|\/go2rtc|frigate\.detector\.[a-z]+)/([0-9]+)/", stats[0]): process = stats[0].split("/") usages[process[len(process) - 2]] = { "bandwidth": round(float(stats[2]), 1), diff --git a/web/src/routes/System.jsx b/web/src/routes/System.jsx index 5dc45257a..012d1be03 100644 --- a/web/src/routes/System.jsx +++ b/web/src/routes/System.jsx @@ -239,6 +239,7 @@ export default function System() { Inference Speed CPU % Memory % + Network Bandwidth @@ -247,6 +248,7 @@ export default function System() { {detectors[detector]['inference_speed']} ms {cpu_usages[detectors[detector]['pid']]?.['cpu'] || '- '}% {cpu_usages[detectors[detector]['pid']]?.['mem'] || '- '}% + {bandwidth_usages[detectors[detector]['pid']]?.['bandwidth'] || '- '}KB/s