mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-05 14:47:40 +03:00
Filter out cmdline items that we are not interested in
This commit is contained in:
parent
5d67ba76fd
commit
7b683583e3
@ -117,12 +117,16 @@ def get_cpu_stats() -> dict[str, dict]:
|
||||
"mem": str(system_mem.percent),
|
||||
}
|
||||
|
||||
keywords = ["ffmpeg", "go2rtc", "frigate.", "python3"]
|
||||
for process in psutil.process_iter(["pid", "name", "cpu_percent", "cmdline"]):
|
||||
pid = str(process.info["pid"])
|
||||
try:
|
||||
cpu_percent = process.info["cpu_percent"]
|
||||
cmdline = " ".join(process.info["cmdline"]).rstrip()
|
||||
|
||||
if not any(keyword in cmdline for keyword in keywords):
|
||||
continue
|
||||
|
||||
with open(f"/proc/{pid}/stat", "r") as f:
|
||||
stats = f.readline().split()
|
||||
utime = int(stats[13])
|
||||
|
||||
Loading…
Reference in New Issue
Block a user