summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMavridis Philippe <[email protected]>2024-09-24 23:37:05 +0300
committerMavridis Philippe <[email protected]>2024-10-02 21:36:51 +0300
commit9a9ab1be61b50c0d183ab690277987729ab50ea3 (patch)
tree612da291fed3de66f5a368476124cc9a70d23bbc
parent058eaa735b9407747c151ac26f351b2d488d52ac (diff)
downloadtdeutils-9a9ab1be61b50c0d183ab690277987729ab50ea3.tar.gz
tdeutils-9a9ab1be61b50c0d183ab690277987729ab50ea3.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 <[email protected]> (cherry picked from commit d4aeda942540952a90e8f88813b85203259400ac)
-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;