summaryrefslogtreecommitdiffstats
path: root/pcp/Platform.c
diff options
context:
space:
mode:
authorExplorer09 <explorer09@gmail.com>2023-08-26 16:56:06 +0800
committercgzones <cgzones@googlemail.com>2023-08-29 21:47:56 +0200
commit25cb42f0e4be70f02dc094d81e033ba21ec18b27 (patch)
tree98bfff2502ecee0a09800f034cb960ad862db0b2 /pcp/Platform.c
parent8ecdb75d74c393895c68be7a311db959b1f373e9 (diff)
Rework ZramMeter and remove MeterClass.comprisedValues
The 'comprisedValues' boolean property unnecessarily complicates the drawing algorithms of Bar meters and Graph meters. Since the only user of 'comprisedValues' is ZramMeter, it is better to rework the meter so that it no longer needs 'comprisedValues'. The 'values[ZRAM_METER_UNCOMPRESSED]' now stores the difference between uncompressed and compressed data size. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Diffstat (limited to 'pcp/Platform.c')
-rw-r--r--pcp/Platform.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/pcp/Platform.c b/pcp/Platform.c
index 13746fc2..87a2ec1f 100644
--- a/pcp/Platform.c
+++ b/pcp/Platform.c
@@ -593,9 +593,13 @@ void Platform_setZramValues(Meter* this) {
free(values);
+ if (stats.usedZramComp > stats.usedZramOrig) {
+ stats.usedZramComp = stats.usedZramOrig;
+ }
+
this->total = stats.totalZram;
this->values[0] = stats.usedZramComp;
- this->values[1] = stats.usedZramOrig;
+ this->values[1] = stats.usedZramOrig - stats.usedZramComp;
}
void Platform_setZfsArcValues(Meter* this) {

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