fix issue with invalid (up|down)total($|kb) calculation (see #127)

also renamed *total* tags to *tot* for consistency with other tags:

  * uptotal.* -> uptot.*
  * downtotal.* -> downtot.*
  * pstotal -> pstot
This commit is contained in:
2017-07-24 15:07:36 +03:00
parent d2e6f2fe38
commit 5e08434835
7 changed files with 23 additions and 20 deletions

View File

@ -46,9 +46,13 @@ AWKeysAggregator::AWKeysAggregator(QObject *_parent)
// network
m_formatter["down"] = FormatterType::NetSmartFormat;
m_formatter["downkb"] = FormatterType::Integer;
m_formatter["downtot"] = FormatterType::MemMBFormat;
m_formatter["downtotkb"] = FormatterType::Integer;
m_formatter["downunits"] = FormatterType::NetSmartUnits;
m_formatter["up"] = FormatterType::NetSmartFormat;
m_formatter["upkb"] = FormatterType::Integer;
m_formatter["uptot"] = FormatterType::MemMBFormat;
m_formatter["uptotkb"] = FormatterType::Integer;
m_formatter["upunits"] = FormatterType::NetSmartUnits;
// swap
m_formatter["swap"] = FormatterType::Float;
@ -468,11 +472,11 @@ QStringList AWKeysAggregator::registerSource(const QString &_source,
int index = m_devices["net"].indexOf(_source.split('/')[2]);
if (index > -1) {
// kb
QString key = QString("%1totalkb%2").arg(type).arg(index);
QString key = QString("%1totkb%2").arg(type).arg(index);
m_map[_source] = key;
m_formatter[key] = FormatterType::Integer;
// mb
key = QString("%1total%2").arg(type).arg(index);
key = QString("%1tot%2").arg(type).arg(index);
m_map.insertMulti(_source, key);
m_formatter[key] = FormatterType::MemMBFormat;
}
@ -498,8 +502,8 @@ QStringList AWKeysAggregator::registerSource(const QString &_source,
m_formatter["ps"] = FormatterType::List;
} else if (_source == "ps/total/count") {
// total processes count
m_map[_source] = "pstotal";
m_formatter["pstotal"] = FormatterType::NoFormat;
m_map[_source] = "pstot";
m_formatter["pstot"] = FormatterType::NoFormat;
} else if (_source.startsWith("quotes")) {
// quotes
QString key = _source;