A complete re-write of my previous post. Got a bit curious and checked out further.
In short: the reason for the difference is that openSUSE uses a patched version of top and free that adds some extra values to `cached'.
A) Standard version
top, free, htop, ...:
Usage is calculated by reading data from /proc/meminfo
:
E.g.:
#free:
Row Column | Corresponding /proc/meminfo entry
-----|--------|----------------------------------
Mem:
total : MemTotal
used : MemTotal - MemFree
free : MemFree
shared : MemShared
buffers : Buffers
cached : Cached
-----|--------|----------------------------------
-/+ buffers/cache:
used : (MemTotal - MemFree) - (Buffers + Cached)
free : MemFree + (Buffers + Cached)
#htop:
Used U* : ((MemTotal - MemFree) - (Buffers + Cached)) / 1024
*I'm using the name Used U
for memory used by User Mode.
Aka Used minus (Cached + Buffers).
So in reality same calculation is used.
htop
display the following in the memory meter:
[Used U % of total | Buffers % of total | Cached % of total ] UsedU MB
(MB is actually MiB.)
B) Patched version
The base for free
and top
on Debian, Fedora, openSuse is is procps-ng.
However, each flavour add their own patches that might, or migh not become
part of the main project.
Under openSUSE we find various additions to the top/free (procps) package.
The ones to take notice of here is some additional values used to represent
the cache value. (I did not include these in my previous post as my system
uses a "clean" procps.)
B.1) Additions
In /proc/meminfo we have Slab which is in-kernel data structure cache. As a sub category we find SReclaimable which is part of Slab that might be
reclaimed for other use both by Kernel and User Mode.
Further we have SwapCached which is memory that once was swapped out, is
swapped in but also is in the swap-file. Thus if one need to swap it out
again, this is already done.
Lastly there is NFS_Unstable which are pages sent to the server but not yet
committed to stable storage.
The following values are added to cache
in the openSUSE patched version:
SReclaimable
SwapCached
NFS_Unstable
(In addition there are some checks that total has to be greater then free,
used has to be greater then buffers + cache etc.)
B.2) Result
Looking at free, as a result the following values are the same:
total, used, free and buffers
.
The following are changed:
cached and "+/- buffers"
.
used = MemTotal - MemFree
old:
cached : Cached
+-/buffers-used: used - (Buffers + Cached)
+/-buffers-free: free + (Buffers + Cached)
patched:
cached : Cached + SReclaimable + SwapCached + NFS_Unstable
+/-buffers-used: used - (Buffers + Cached + SReclaimable +
SwapCached + NFS_Unstable)
+/-buffers-free: free + (Buffers + Cached + SReclaimable +
SwapCached + NFS_Unstable)
The same additions are done to top.
htop is unchanged and thus only aligning with older / or un-patched versions
of top / free.
From htop source code, file UptimeMeter.c, you can see:
char daysbuf[15];
if (days > 100) {
sprintf(daysbuf, "%d days(!), ", days);
} else if (days > 1) {
sprintf(daysbuf, "%d days, ", days);
} else if (days == 1) {
sprintf(daysbuf, "1 day, ");
} else {
daysbuf[0] = '\0';
}
I think !
here is just a mark that server has been up for more than 100 days.
Reference
Best Answer
Don't you have colors?
Where green should be 1978 MiB.
Else you can enter F2 -> Under setup stay on "Meters" -> Right arrow to get to "Left column". -> Down 1 to get to "Memory Bar".
Then press enter to view various ways of display.
When it comes to what the bar displays it is like this.
It reads
/proc/meminfo
and show - colors depend on "Colors" setting - this is default:And then the percentage of
MemTotal
of that.Bar:
Also see here.
I have a script some where that makes it as well. Have to look for it.