Mail archive
alpine-user

[alpine-user] Re: Wrong system monitor numbers

From: Cág <caoc_at_riseup.net>
Date: Mon, 18 Jul 2016 13:19:42 +0300

Hi,

In case someone is interested, I've found the cause and the solution.

The cause is vmstat, free and htop in Alpine all use different count
methods.
For example, free to count used memory uses the following formula
in buffers/cache:
used - (buffers + cached)

free and vmstat from Debian are patched to count the same:
used - (Buffers + Cached + SReclaimable +
         SwapCached + NFS_Unstable)

In both cases "used" is MemTotal - MemFree.
So, here's my solution to print used memory in format "used/total" in
MB,
e.g. "30/5850":

cat /proc/meminfo | awk '{ print $2 }' ORS=' ' | \
   awk '{ printf "%d/%d", (($1-$2)-($4+$5+$6+$23+$27))/1024, $1/1024 }'

Cheers,
Cág


---
Unsubscribe:  alpine-user+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-user+help_at_lists.alpinelinux.org
---
Received on Mon Jul 18 2016 - 13:19:42 GMT