Commit 1c0a168a authored by David Redondo's avatar David Redondo 🏎

Add sensor id conversion for new memory plugin

parent b06d50bc
/*
* Copyright 2020 Arjen Hiemstra <ahiemstra@heimr.nl>
* Copyright 2020 David Redondo <kde@david-redondo.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -106,7 +107,7 @@ private Q_SLOTS:
};
QTest::addRow("cpu")
<< QJsonArray {
<< QJsonArray {
QStringLiteral("cpu/cpu1/clock"),
QStringLiteral("cpu/cpu1/sys"),
QStringLiteral("cpu/cpu1/TotalLoad"),
......@@ -124,6 +125,45 @@ private Q_SLOTS:
QStringLiteral("cpu/all/user"),
QStringLiteral("cpu/all/wait"),
};
QTest::addRow("memory")
<< QJsonArray{
QStringLiteral("mem/physical/allocated"),
QStringLiteral("mem/physical/allocatedlevel"),
QStringLiteral("mem/physical/application"),
QStringLiteral("mem/physical/applicationlevel"),
QStringLiteral("mem/physical/available"),
QStringLiteral("mem/physical/availablelevel"),
QStringLiteral("mem/physical/buf"),
QStringLiteral("mem/physical/buflevel"),
QStringLiteral("mem/physical/cached"),
QStringLiteral("mem/physical/cachedlevel"),
QStringLiteral("mem/physical/free"),
QStringLiteral("mem/physical/freelevel"),
QStringLiteral("mem/physical/total"),
QStringLiteral("mem/physical/used"),
QStringLiteral("mem/physical/usedlevel"),
QStringLiteral("mem/swap/free"),
QStringLiteral("mem/swap/used"),
} << QJsonArray {
QStringLiteral("memory/physical/used"),
QStringLiteral("memory/physical/usedPercent"),
QStringLiteral("memory/physical/application"),
QStringLiteral("memory/physical/applicationPercent"),
QStringLiteral("memory/physical/free"),
QStringLiteral("memory/physical/freePercent"),
QStringLiteral("memory/physical/buffer"),
QStringLiteral("memory/physical/bufferPercent"),
QStringLiteral("memory/physical/cache"),
QStringLiteral("memory/physical/cachePercent"),
QStringLiteral("memory/physical/free"),
QStringLiteral("memory/physical/freePercent"),
QStringLiteral("memory/physical/total"),
QStringLiteral("memory/physical/used"),
QStringLiteral("memory/physical/usedPercent"),
QStringLiteral("memory/swap/free"),
QStringLiteral("memory/swap/used"),
};
}
void testSensorIdConversion()
......
......@@ -167,6 +167,12 @@ SensorFaceControllerPrivate::SensorFaceControllerPrivate()
{ QRegularExpression(QStringLiteral("cpu/(.*)/sys$")), QStringLiteral("cpu/\\1/system")},
{ QRegularExpression(QStringLiteral("cpu/(.*)/TotalLoad$")), QStringLiteral("cpu/\\1/usage")},
{ QRegularExpression(QStringLiteral("cpu/cpu(\\d+)/clock$")), QStringLiteral("cpu/cpu\\1/frequency")},
{ QRegularExpression(QStringLiteral("mem/(.*)level")), QStringLiteral("mem/\\1Percent")},
{ QRegularExpression(QStringLiteral("mem/physical/allocated")), QStringLiteral("memory/physical/used")},
{ QRegularExpression(QStringLiteral("mem/physical/available")), QStringLiteral("memory/physical/free")},
{ QRegularExpression(QStringLiteral("mem/physical/buf")), QStringLiteral("memory/physical/buffer")},
{ QRegularExpression(QStringLiteral("mem/physical/cached")), QStringLiteral("memory/physical/cache")},
{ QRegularExpression(QStringLiteral("^mem/(.*)")), QStringLiteral("memory/\\1")},
};
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment