mirror of
https://github.com/xzeldon/htop.git
synced 2024-12-23 22:55:46 +00:00
Cached memory calculations, take 2.
Thanks to @OmegaPhil for discussion and reviewing.
This commit is contained in:
parent
5bc1f5ed04
commit
a84aa2e782
@ -621,7 +621,6 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char*
|
||||
|
||||
static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) {
|
||||
unsigned long long int swapFree = 0;
|
||||
unsigned long long int slab = 0;
|
||||
unsigned long long int shmem = 0;
|
||||
unsigned long long int sreclaimable = 0;
|
||||
|
||||
@ -651,9 +650,6 @@ static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) {
|
||||
if (tryRead("SwapTotal:", &this->totalSwap)) {}
|
||||
else if (tryRead("SwapFree:", &swapFree)) {}
|
||||
break;
|
||||
case 'l':
|
||||
if (tryRead("Slab:", &slab)) {}
|
||||
break;
|
||||
case 'h':
|
||||
if (tryRead("Shmem:", &shmem)) {}
|
||||
break;
|
||||
@ -666,8 +662,8 @@ static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) {
|
||||
#undef tryRead
|
||||
}
|
||||
|
||||
this->usedMem = this->totalMem - this->freeMem + (slab - sreclaimable) + shmem;
|
||||
this->cachedMem = this->cachedMem + sreclaimable;
|
||||
this->usedMem = this->totalMem - this->freeMem;
|
||||
this->cachedMem = this->cachedMem + sreclaimable - shmem;
|
||||
this->usedSwap = this->totalSwap - swapFree;
|
||||
fclose(file);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user