|
|
|
@ -1733,6 +1733,7 @@ errorReadingProcess: |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) { |
|
|
|
static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) { |
|
|
|
|
|
|
|
LinuxProcessList *lpl = (LinuxProcessList *)this; |
|
|
|
memory_t availableMem = 0; |
|
|
|
memory_t availableMem = 0; |
|
|
|
memory_t freeMem = 0; |
|
|
|
memory_t freeMem = 0; |
|
|
|
memory_t totalMem = 0; |
|
|
|
memory_t totalMem = 0; |
|
|
|
@ -1743,6 +1744,8 @@ static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) { |
|
|
|
memory_t swapCacheMem = 0; |
|
|
|
memory_t swapCacheMem = 0; |
|
|
|
memory_t swapFreeMem = 0; |
|
|
|
memory_t swapFreeMem = 0; |
|
|
|
memory_t sreclaimableMem = 0; |
|
|
|
memory_t sreclaimableMem = 0; |
|
|
|
|
|
|
|
memory_t zswapCompMem = 0; |
|
|
|
|
|
|
|
memory_t zswapOrigMem = 0; |
|
|
|
|
|
|
|
|
|
|
|
FILE* file = fopen(PROCMEMINFOFILE, "r"); |
|
|
|
FILE* file = fopen(PROCMEMINFOFILE, "r"); |
|
|
|
if (!file) |
|
|
|
if (!file) |
|
|
|
@ -1787,6 +1790,10 @@ static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) { |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
case 'Z': |
|
|
|
|
|
|
|
tryRead("Zswap:", zswapCompMem); |
|
|
|
|
|
|
|
tryRead("Zswapped:", zswapOrigMem); |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#undef tryRead |
|
|
|
#undef tryRead |
|
|
|
@ -1812,6 +1819,8 @@ static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) { |
|
|
|
this->totalSwap = swapTotalMem; |
|
|
|
this->totalSwap = swapTotalMem; |
|
|
|
this->usedSwap = swapTotalMem - swapFreeMem - swapCacheMem; |
|
|
|
this->usedSwap = swapTotalMem - swapFreeMem - swapCacheMem; |
|
|
|
this->cachedSwap = swapCacheMem; |
|
|
|
this->cachedSwap = swapCacheMem; |
|
|
|
|
|
|
|
lpl->zswap.usedZswapComp = zswapCompMem; |
|
|
|
|
|
|
|
lpl->zswap.usedZswapOrig = zswapOrigMem; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void LinuxProcessList_scanHugePages(LinuxProcessList* this) { |
|
|
|
static void LinuxProcessList_scanHugePages(LinuxProcessList* this) { |
|
|
|
@ -1870,6 +1879,24 @@ static void LinuxProcessList_scanHugePages(LinuxProcessList* this) { |
|
|
|
closedir(dir); |
|
|
|
closedir(dir); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static inline void LinuxProcessList_scanZswapInfo(LinuxProcessList *this) { |
|
|
|
|
|
|
|
long max_pool_percent = 0; |
|
|
|
|
|
|
|
int r; |
|
|
|
|
|
|
|
char buf[256]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
r = xReadfile("/sys/module/zswap/parameters/max_pool_percent", buf, 256); |
|
|
|
|
|
|
|
if (r <= 0) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
max_pool_percent = strtol(buf, NULL, 10); |
|
|
|
|
|
|
|
if (max_pool_percent < 0 || max_pool_percent > 100) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this->zswap.totalZswapPool = this->super.totalMem * max_pool_percent / 100; |
|
|
|
|
|
|
|
/* the rest of the metrics are set in LinuxProcessList_scanMemoryInfo() */ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static inline void LinuxProcessList_scanZramInfo(LinuxProcessList* this) { |
|
|
|
static inline void LinuxProcessList_scanZramInfo(LinuxProcessList* this) { |
|
|
|
memory_t totalZram = 0; |
|
|
|
memory_t totalZram = 0; |
|
|
|
memory_t usedZramComp = 0; |
|
|
|
memory_t usedZramComp = 0; |
|
|
|
@ -2222,6 +2249,7 @@ void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) { |
|
|
|
LinuxProcessList_scanHugePages(this); |
|
|
|
LinuxProcessList_scanHugePages(this); |
|
|
|
LinuxProcessList_scanZfsArcstats(this); |
|
|
|
LinuxProcessList_scanZfsArcstats(this); |
|
|
|
LinuxProcessList_scanZramInfo(this); |
|
|
|
LinuxProcessList_scanZramInfo(this); |
|
|
|
|
|
|
|
LinuxProcessList_scanZswapInfo(this); |
|
|
|
|
|
|
|
|
|
|
|
double period = LinuxProcessList_scanCPUTime(super); |
|
|
|
double period = LinuxProcessList_scanCPUTime(super); |
|
|
|
|
|
|
|
|
|
|
|
|