diff options
author | David Zarzycki <dave@znu.io> | 2021-01-07 08:38:18 -0500 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2021-01-11 20:27:47 +0100 |
commit | 37e186fd6626e83f51d0267052677355575964d4 (patch) | |
tree | c3212ebbc5a948c4ede190defadd8f56e097d45b /linux/LinuxProcessList.c | |
parent | f4404effa45ce378a8a72f2fff9641c7d7a0cc6f (diff) |
Linux: Add SwapCached to the swap meter
According to the Linux kernel documentation, "SwapCached" tracks "memory
that once was swapped out, is swapped back in but still also is
in the swapfile (if memory is needed it doesn't need to be swapped out
AGAIN because it is already in the swapfile. This saves I/O)."
Diffstat (limited to 'linux/LinuxProcessList.c')
-rw-r--r-- | linux/LinuxProcessList.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c index a8514e28..49b2d0e1 100644 --- a/linux/LinuxProcessList.c +++ b/linux/LinuxProcessList.c @@ -1508,6 +1508,7 @@ static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) { switch (buffer[1]) { case 'w': tryRead("SwapTotal:", &this->totalSwap); + tryRead("SwapCached:", &this->cachedSwap); tryRead("SwapFree:", &swapFree); break; case 'h': @@ -1524,7 +1525,7 @@ static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) { this->usedMem = this->totalMem - freeMem; this->cachedMem = this->cachedMem + sreclaimable - shmem; - this->usedSwap = this->totalSwap - swapFree; + this->usedSwap = this->totalSwap - swapFree - this->cachedSwap; fclose(file); } |