Commit 43025364 authored by David Redondo's avatar David Redondo 🏎

Add sensor id conversion for cpu

parent 5d5dd393
......@@ -91,6 +91,7 @@ private Q_SLOTS:
{newPrefix + QStringLiteral("/used")},
};
}
QTest::addRow("paritionsall")
<< QJsonArray {
QStringLiteral("partitions/all/total"),
......@@ -103,7 +104,28 @@ private Q_SLOTS:
QStringLiteral("disk/all/usedPercent"),
QStringLiteral("disk/all/used"),
};
QTest::addRow("cpu")
<< QJsonArray {
QStringLiteral("cpu/cpu1/clock"),
QStringLiteral("cpu/cpu1/sys"),
QStringLiteral("cpu/cpu1/TotalLoad"),
QStringLiteral("cpu/system/sys"),
QStringLiteral("cpu/system/TotalLoad"),
QStringLiteral("cpu/system/user"),
QStringLiteral("cpu/system/wait"),
}
<< QJsonArray {
QStringLiteral("cpu/cpu1/frequency"),
QStringLiteral("cpu/cpu1/system"),
QStringLiteral("cpu/cpu1/usage"),
QStringLiteral("cpu/all/system"),
QStringLiteral("cpu/all/usage"),
QStringLiteral("cpu/all/user"),
QStringLiteral("cpu/all/wait"),
};
}
void testSensorIdConversion()
{
QFETCH(QJsonArray, oldSensors);
......
......@@ -163,6 +163,10 @@ SensorFaceControllerPrivate::SensorFaceControllerPrivate()
{ QRegularExpression(QStringLiteral("(.*)/freespace$")), QStringLiteral("\\1/free")},
{ QRegularExpression(QStringLiteral("(.*)/filllevel$")), QStringLiteral("\\1/usedPercent")},
{ QRegularExpression(QStringLiteral("(.*)/usedspace$")), QStringLiteral("\\1/used")},
{ QRegularExpression(QStringLiteral("cpu/system/(.*)$")), QStringLiteral("cpu/all/\\1")},
{ 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")},
};
}
}
......
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