diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2021-03-03 19:48:30 +0100 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2021-03-15 22:34:14 +0100 |
commit | d9f2eacbc5b3fccf63b24944ce9a30d762baea3c (patch) | |
tree | 1d8f44915c8f06b305cf820c1bb4bef05ac01bd7 /linux/LinuxProcessList.c | |
parent | a4173f52097fd78d0dab2e3296514e7dc7e54660 (diff) |
Linux: individually show shared memory
Shmem: Total memory used by shared memory (shmem) and tmpfs
Source: https://www.kernel.org/doc/Documentation/filesystems/proc.txt
Closes: #556
Diffstat (limited to 'linux/LinuxProcessList.c')
-rw-r--r-- | linux/LinuxProcessList.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c index 9eb64173..7d1d6e19 100644 --- a/linux/LinuxProcessList.c +++ b/linux/LinuxProcessList.c @@ -1507,6 +1507,7 @@ static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) { memory_t totalMem = 0; memory_t buffersMem = 0; memory_t cachedMem = 0; + memory_t sharedMem = 0; memory_t swapTotalMem = 0; memory_t swapCacheMem = 0; memory_t swapFreeMem = 0; @@ -1542,6 +1543,9 @@ static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) { break; case 'S': switch (buffer[1]) { + case 'h': + tryRead("Shmem:", sharedMem); + break; case 'w': tryRead("SwapTotal:", swapTotalMem); tryRead("SwapCached:", swapCacheMem); @@ -1565,7 +1569,8 @@ static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) { */ this->totalMem = totalMem; this->cachedMem = cachedMem + sreclaimableMem; - const memory_t usedDiff = freeMem + cachedMem + sreclaimableMem + buffersMem; + this->sharedMem = sharedMem; + const memory_t usedDiff = freeMem + cachedMem + sreclaimableMem + buffersMem + sharedMem; this->usedMem = (totalMem >= usedDiff) ? totalMem - usedDiff : totalMem - freeMem; this->buffersMem = buffersMem; this->availableMem = availableMem != 0 ? MINIMUM(availableMem, totalMem) : freeMem; |