diff options
-rw-r--r-- | src/memory.c | 10 |
1 files changed, 9 insertions, 1 deletions
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}' | " |