diff options
-rw-r--r-- | superkaramba/src/memsensor.cpp | 55 |
1 files changed, 32 insertions, 23 deletions
diff --git a/superkaramba/src/memsensor.cpp b/superkaramba/src/memsensor.cpp index 3223b0b..d3ee39b 100644 --- a/superkaramba/src/memsensor.cpp +++ b/superkaramba/src/memsensor.cpp @@ -288,7 +288,7 @@ void MemSensor::readValues() } #define SUB_FORMAT_STR(fstring, value) \ - format.replace(TQRegExp(#fstring, false), TQString::number((int)(value))); + format.replace(TQRegExp(#fstring, false), TQString::number((int)(value))) void MemSensor::update() { @@ -322,24 +322,32 @@ void MemSensor::update() format = "%um"; } - SUB_FORMAT_STR(%fmbp, (totalMem - usedMemNoBuffers) * 100.0 / totalMem) - SUB_FORMAT_STR(%fmb, (totalMem - usedMemNoBuffers) / 1024.0 + 0.5) - SUB_FORMAT_STR(%fmp, (totalMem - usedMem) * 100.0 / totalMem) - SUB_FORMAT_STR(%fm, (totalMem - usedMem) / 1024.0 + 0.5) - - SUB_FORMAT_STR(%umbp, usedMemNoBuffers * 100.0 / totalMem) - SUB_FORMAT_STR(%umb, usedMemNoBuffers / 1024.0 + 0.5) - SUB_FORMAT_STR(%ump, usedMem * 100.0 / totalMem) - SUB_FORMAT_STR(%um, usedMem / 1024.0 + 0.5) - - SUB_FORMAT_STR(%tm, totalMem / 1024.0 + 0.5) - - SUB_FORMAT_STR(%fsp, (totalSwap - usedSwap) * 100.0 / totalSwap) - SUB_FORMAT_STR(%fs, (totalSwap - usedSwap) / 1024.0 + 0.5) - SUB_FORMAT_STR(%usp, usedSwap * 100.0 / totalSwap) - SUB_FORMAT_STR(%us, usedSwap / 1024.0 + 0.5) - - SUB_FORMAT_STR(%ts, totalSwap / 1024.0 + 0.5) + SUB_FORMAT_STR(%fmbp, (totalMem - usedMemNoBuffers) * 100.0 / totalMem); + SUB_FORMAT_STR(%fmbg, (totalMem - usedMemNoBuffers) / 1024.0 / 1024.0 + 1); + SUB_FORMAT_STR(%fmb, (totalMem - usedMemNoBuffers) / 1024.0 + 0.5); + SUB_FORMAT_STR(%fmp, (totalMem - usedMem) * 100.0 / totalMem); + SUB_FORMAT_STR(%fmg, (totalMem - usedMem) / 1024.0 / 1024.0 + 1); + SUB_FORMAT_STR(%fm, (totalMem - usedMem) / 1024.0 + 0.5); + + SUB_FORMAT_STR(%umbp, usedMemNoBuffers * 100.0 / totalMem); + SUB_FORMAT_STR(%umbg, usedMemNoBuffers / 1024.0 / 1024.0 + 1); + SUB_FORMAT_STR(%umb, usedMemNoBuffers / 1024.0 + 0.5); + SUB_FORMAT_STR(%ump, usedMem * 100.0 / totalMem); + SUB_FORMAT_STR(%umg, usedMem / 1024.0 / 1024.0 + 1); + SUB_FORMAT_STR(%um, usedMem / 1024.0 + 0.5); + + SUB_FORMAT_STR(%tmg, totalMem / 1024.0 / 1024.0 + 1); + SUB_FORMAT_STR(%tm, totalMem / 1024.0 + 0.5); + + SUB_FORMAT_STR(%fsp, (totalSwap - usedSwap) * 100.0 / totalSwap); + SUB_FORMAT_STR(%fsg, (totalSwap - usedSwap) / 1024.0 / 1024.0 + 1); + SUB_FORMAT_STR(%fs, (totalSwap - usedSwap) / 1024.0 + 0.5); + SUB_FORMAT_STR(%usp, usedSwap * 100.0 / totalSwap); + SUB_FORMAT_STR(%usg, usedSwap / 1024.0 / 1024.0 + 1); + SUB_FORMAT_STR(%us, usedSwap / 1024.0 + 0.5); + + SUB_FORMAT_STR(%tsg, totalSwap / 1024.0 / 1024.0 + 1); + SUB_FORMAT_STR(%ts, totalSwap / 1024.0 + 0.5); meter->setValue(format); ++it; @@ -365,18 +373,19 @@ void MemSensor::setMaxValue( SensorParams *sp ) { f = "%um"; } - else if (f.endsWith("p")) { meter->setMax(100); } - else if (f == "%fm" || f == "%um" || f == "%fmb" || f == "%umb") { meter->setMax(getMemTotal() / 1024); } - - else if (f == "%fs" || f == "%us") + else if (f == "%fmg" || f == "%umg" || f == "%fmbg" || f == "%umbg") + { + meter->setMax(getMemTotal() / 1024 / 1024); + } + else if (f == "%fs" || f == "%us" || f == "%fsg" || f == "%usg") { meter->setMax(getSwapTotal() / 1024); } |