summaryrefslogtreecommitdiffstats
path: root/linux/Platform.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2021-01-06 18:11:24 +0100
committerChristian Göttsche <cgzones@googlemail.com>2021-02-07 12:41:52 +0100
commit3d497a3760626d398fffc8f4594e8b9658f67d55 (patch)
tree31f5f760e5039d220606461929ac48f365aff269 /linux/Platform.c
parent0d67263b36f0f1b45a2f10ec80c15766ca218ce5 (diff)
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).
Diffstat (limited to 'linux/Platform.c')
-rw-r--r--linux/Platform.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/linux/Platform.c b/linux/Platform.c
index 80b276ef..83c62d32 100644
--- a/linux/Platform.c
+++ b/linux/Platform.c
@@ -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;

© 2014-2024 Faster IT GmbH | imprint | privacy policy