summaryrefslogtreecommitdiffstats
path: root/pcp/PCPMachine.c
diff options
context:
space:
mode:
authorNathan Scott <nathans@redhat.com>2023-11-20 15:59:41 +1100
committerNathan Scott <nathans@redhat.com>2023-11-20 15:59:41 +1100
commit452244dc06270aff4872a3c3d9559e7da5f34ad6 (patch)
tree198c178d126253d53dfbf06a7d0d6d8cc29785a8 /pcp/PCPMachine.c
parente49a40ad82c7ce122f30b0056a2fc2cdb1a208b0 (diff)
PCP platform implementation of frontswap and zswap accounting
Diffstat (limited to 'pcp/PCPMachine.c')
-rw-r--r--pcp/PCPMachine.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/pcp/PCPMachine.c b/pcp/PCPMachine.c
index 5f24a284..faf3ae96 100644
--- a/pcp/PCPMachine.c
+++ b/pcp/PCPMachine.c
@@ -178,6 +178,19 @@ static void PCPMachine_updatePerCPUReal(PCPMachine* this, Metric metric, CPUMetr
this->percpu[i][cpumetric].d = this->values[i].d;
}
+static inline void PCPMachine_scanZswapInfo(PCPMachine* this) {
+ const Machine* host = &this->super;
+ pmAtomValue value;
+
+ memset(&this->zswap, 0, sizeof(ZswapStats));
+ if (Metric_values(PCP_ZSWAP_MAX_POOL_PERCENT, &value, 1, PM_TYPE_U64))
+ this->zswap.totalZswapPool = host->totalMem * value.ull / 100;
+ if (Metric_values(PCP_MEM_ZSWAP, &value, 1, PM_TYPE_U64))
+ this->zswap.usedZswapComp = value.ull;
+ if (Metric_values(PCP_MEM_ZSWAPPED, &value, 1, PM_TYPE_U64))
+ this->zswap.usedZswapOrig = value.ull;
+}
+
static inline void PCPMachine_scanZfsArcstats(PCPMachine* this) {
unsigned long long int dbufSize = 0;
unsigned long long int dnodeSize = 0;
@@ -251,6 +264,7 @@ static void PCPMachine_scan(PCPMachine* this) {
PCPMachine_updatePerCPUReal(this, PCP_HINV_CPUCLOCK, CPU_FREQUENCY);
PCPMachine_scanZfsArcstats(this);
+ PCPMachine_scanZswapInfo(this);
}
void Machine_scan(Machine* super) {

© 2014-2024 Faster IT GmbH | imprint | privacy policy