From e74aee761ae2470b2c205fefa70b2a46a4be1b0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AB=8F=E8=A8=AA=E5=AD=90?= Date: Tue, 18 Jun 2024 13:48:55 +0900 Subject: =?UTF-8?q?FreeBSD:=20=E6=AD=A3=E3=81=97=E3=81=84=E3=83=A1?= =?UTF-8?q?=E3=83=A2=E3=83=AA=E3=81=AE=E8=A1=A8=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/memory.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/memory.c b/src/memory.c index 371e05c..6589da1 100644 --- a/src/memory.c +++ b/src/memory.c @@ -31,8 +31,16 @@ void display_memory() { memused = run_mem_command("vmstat | awk 'END {printf $3}' | sed 's/M//'"); memtotal = run_mem_command("sysctl -n hw.physmem") / 1024LL / 1024LL; #elif defined(__FreeBSD__) || defined(__DragonFly__) - memused = run_mem_command("top | grep \"Mem:\" | awk '{print $2}' | " + // 13M Active, 200M Inact, 184M Laundry, + long long int used1 = run_mem_command("top | grep \"Mem:\" | awk '{print $2}' | " "sed 's/M//'"); + long long int used2 = run_mem_command("top | grep \"Mem:\" | awk '{print $4}' | " + "sed 's/M//'"); + long long int used3 = run_mem_command("top | grep \"Mem:\" | awk '{print $6}' | " + "sed 's/M//'"); + long long int used4 = run_mem_command("top | grep \"ARC:\" | awk '{print $6}' | " + "sed 's/M//'"); + memused = used1 + used2 + used3 + used4; memtotal = run_mem_command("sysctl -n hw.physmem") / 1024LL / 1024LL; #elif defined(__NetBSD__) memused = run_mem_command("top | grep \"Memory:\" | awk '{print $2}' | " -- cgit v1.2.3