forked from Github/frigate
Add cmdline information to CPU usage stats in get_cpu_stats() function and display it in the System page's ffmpeg table with a copy-to-clipboard button (#6430)
This commit is contained in:
committed by
GitHub
parent
181b53a55d
commit
5fb96c777a
@@ -800,10 +800,11 @@ def get_cpu_stats() -> dict[str, dict]:
|
||||
docker_memlimit = get_docker_memlimit_bytes() / 1024
|
||||
total_mem = os.sysconf("SC_PAGE_SIZE") * os.sysconf("SC_PHYS_PAGES") / 1024
|
||||
|
||||
for process in psutil.process_iter(["pid", "name", "cpu_percent"]):
|
||||
for process in psutil.process_iter(["pid", "name", "cpu_percent", "cmdline"]):
|
||||
pid = process.info["pid"]
|
||||
try:
|
||||
cpu_percent = process.info["cpu_percent"]
|
||||
cmdline = process.info["cmdline"]
|
||||
|
||||
with open(f"/proc/{pid}/stat", "r") as f:
|
||||
stats = f.readline().split()
|
||||
@@ -837,6 +838,7 @@ def get_cpu_stats() -> dict[str, dict]:
|
||||
"cpu": str(cpu_percent),
|
||||
"cpu_average": str(round(cpu_average_usage, 2)),
|
||||
"mem": f"{mem_pct}",
|
||||
"cmdline": " ".join(cmdline),
|
||||
}
|
||||
except:
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user