mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 12:14:36 +03:00
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
This commit is contained in:

committed by
BenBE

parent
a4173f5209
commit
d9f2eacbc5
@ -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;
|
||||
|
@ -287,7 +287,8 @@ void Platform_setMemoryValues(Meter* this) {
|
||||
this->values[0] = pl->usedMem > lpl->totalHugePageMem ? pl->usedMem - lpl->totalHugePageMem : pl->usedMem;
|
||||
this->values[1] = pl->buffersMem;
|
||||
this->values[2] = pl->cachedMem;
|
||||
this->values[3] = pl->availableMem;
|
||||
this->values[3] = pl->sharedMem;
|
||||
this->values[4] = pl->availableMem;
|
||||
|
||||
if (lpl->zfs.enabled != 0) {
|
||||
this->values[0] -= lpl->zfs.size;
|
||||
|
Reference in New Issue
Block a user