mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 12:14:36 +03:00
Linux: overhaul memory partition
Use similar calculation than procps. Show AvailableMemory in text mode. Use total minus available memory instead of manually computed used- memory as fraction part in bar mode (if available).
This commit is contained in:
@ -283,14 +283,11 @@ void Platform_setMemoryValues(Meter* this) {
|
||||
const ProcessList* pl = this->pl;
|
||||
const LinuxProcessList* lpl = (const LinuxProcessList*) pl;
|
||||
|
||||
long int usedMem = pl->usedMem;
|
||||
long int buffersMem = pl->buffersMem;
|
||||
long int cachedMem = pl->cachedMem;
|
||||
usedMem -= buffersMem + cachedMem + lpl->totalHugePageMem;
|
||||
this->total = pl->totalMem - lpl->totalHugePageMem;
|
||||
this->values[0] = usedMem;
|
||||
this->values[1] = buffersMem;
|
||||
this->values[2] = cachedMem;
|
||||
this->total = pl->totalMem;
|
||||
this->values[0] = pl->usedMem;
|
||||
this->values[1] = pl->buffersMem;
|
||||
this->values[2] = pl->cachedMem;
|
||||
this->values[3] = pl->availableMem;
|
||||
|
||||
if (lpl->zfs.enabled != 0) {
|
||||
this->values[0] -= lpl->zfs.size;
|
||||
|
Reference in New Issue
Block a user