summaryrefslogtreecommitdiffstats
path: root/superkaramba
diff options
context:
space:
mode:
authorMavridis Philippe <mavridisf@gmail.com>2024-09-24 23:37:05 +0300
committerMavridis Philippe <mavridisf@gmail.com>2024-09-29 11:26:26 +0300
commitd4aeda942540952a90e8f88813b85203259400ac (patch)
treef6473e68149744148cd3223500bd26b974eb6de9 /superkaramba
parent4dc2cda713ac85dffebcb94df97c0ca79d24c515 (diff)
downloadtdeutils-d4aeda942540952a90e8f88813b85203259400ac.tar.gz
tdeutils-d4aeda942540952a90e8f88813b85203259400ac.zip
Superkaramba: add memory sensor percentage format strings
The strings which end in 'p' represent percentage value variants of the following pre-existing format strings: %fmb(p) %fm(p) %umb(p) %um(p) %fs(p) %us(p) Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Diffstat (limited to 'superkaramba')
-rw-r--r--superkaramba/src/memsensor.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/superkaramba/src/memsensor.cpp b/superkaramba/src/memsensor.cpp
index 1d6c4dc..8da5d58 100644
--- a/superkaramba/src/memsensor.cpp
+++ b/superkaramba/src/memsensor.cpp
@@ -319,17 +319,24 @@ void MemSensor::update()
format = "%um";
}
- format.replace( TQRegExp("%fmb", false), TQString::number( (int)(( totalMem - usedMemNoBuffers)/1024.0+0.5)));
- format.replace( TQRegExp("%fm", false), TQString::number( (int)( ( totalMem - usedMem )/1024.0+0.5) ));
+ format.replace( TQRegExp("%fmbp", false), TQString::number( (int)((totalMem - usedMemNoBuffers) * 100.0 / totalMem) ));
+ format.replace( TQRegExp("%fmb", false), TQString::number( (int)((totalMem - usedMemNoBuffers) / 1024.0 + 0.5) ));
+ format.replace( TQRegExp("%fmp", false), TQString::number( (int)((totalMem - usedMem) * 100.0 / totalMem) ));
+ format.replace( TQRegExp("%fm", false), TQString::number( (int)((totalMem - usedMem) / 1024.0 + 0.5) ));
- format.replace( TQRegExp("%umb", false), TQString::number( (int)((usedMemNoBuffers)/1024.0+0.5)));
- format.replace( TQRegExp("%um", false), TQString::number( (int)((usedMem)/1024.0+0.5 )));
+ format.replace( TQRegExp("%umbp", false), TQString::number( (int)(usedMemNoBuffers * 100.0 / totalMem) ));
+ format.replace( TQRegExp("%umb", false), TQString::number( (int)(usedMemNoBuffers / 1024.0 + 0.5) ));
+ format.replace( TQRegExp("%ump", false), TQString::number( (int)(usedMem * 100.0 / totalMem) ));
+ format.replace( TQRegExp("%um", false), TQString::number( (int)(usedMem / 1024.0 + 0.5) ));
- format.replace( TQRegExp("%tm", false), TQString::number( (int)( (totalMem)/1024.0+0.5)));
+ format.replace( TQRegExp("%tm", false), TQString::number( (int)(totalMem / 1024.0 + 0.5) ));
- format.replace( TQRegExp("%fs", false), TQString::number( (int)((totalSwap - usedSwap)/1024.0+0.5)));
- format.replace( TQRegExp("%us", false), TQString::number( (int)(usedSwap/1024.0+0.5)));
- format.replace( TQRegExp("%ts", false), TQString::number( (int)(totalSwap/1024.0+0.5)));
+ format.replace( TQRegExp("%fsp", false), TQString::number( (int)((totalSwap - usedSwap) * 100.0 / totalSwap) ));
+ format.replace( TQRegExp("%fs", false), TQString::number( (int)((totalSwap - usedSwap) / 1024.0 + 0.5) ));
+ format.replace( TQRegExp("%usp", false), TQString::number( (int)(usedSwap * 100.0 / totalSwap) ));
+ format.replace( TQRegExp("%us", false), TQString::number( (int)(usedSwap / 1024.0 + 0.5) ));
+
+ format.replace( TQRegExp("%ts", false), TQString::number( (int)(totalSwap / 1024.0 + 0.5) ));
meter->setValue(format);
++it;