diff options
author | 諏訪子 <suwako@076.moe> | 2024-06-18 13:48:55 +0900 |
---|---|---|
committer | 諏訪子 <suwako@076.moe> | 2024-06-18 13:48:55 +0900 |
commit | e74aee761ae2470b2c205fefa70b2a46a4be1b0d (patch) | |
tree | fc9511b496e4dd21cc8977167cee1c7aa2ab4618 /src | |
parent | 7effecbcd3fd8869d32448d6ae6b5f1ccb0efe08 (diff) |
FreeBSD: 正しいメモリの表示
Diffstat (limited to 'src')
-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}' | " |