From 3d497a3760626d398fffc8f4594e8b9658f67d55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Wed, 6 Jan 2021 18:11:24 +0100 Subject: 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). --- ProcessList.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'ProcessList.h') diff --git a/ProcessList.h b/ProcessList.h index cb17f0d7..3cd10a4e 100644 --- a/ProcessList.h +++ b/ProcessList.h @@ -34,6 +34,9 @@ in the source distribution for its full text. #define MAX_READ 2048 #endif +typedef unsigned long long int memory_t; +#define MEMORY_MAX ULLONG_MAX + typedef struct ProcessList_ { const Settings* settings; @@ -61,14 +64,15 @@ typedef struct ProcessList_ { int userlandThreads; int kernelThreads; - unsigned long long int totalMem; - unsigned long long int usedMem; - unsigned long long int buffersMem; - unsigned long long int cachedMem; + memory_t totalMem; + memory_t usedMem; + memory_t buffersMem; + memory_t cachedMem; + memory_t availableMem; - unsigned long long int totalSwap; - unsigned long long int usedSwap; - unsigned long long int cachedSwap; + memory_t totalSwap; + memory_t usedSwap; + memory_t cachedSwap; int cpuCount; -- cgit v1.2.3