monitor: include previous targets and tachs in PEL
To discover the source of certain fan ramp-up failures, this change
outputs the previous 8 targets and tach readings. The strategy is to see
if hardware limitations prevent attaining the targets quickly enough.
Signed-off-by: Mike Capps <mikepcapps@gmail.com>
Change-Id: Ia38867986b8a8a651de5d01766393c07d413273c
diff --git a/monitor/tach_sensor.cpp b/monitor/tach_sensor.cpp
index 36b20b1..0ff1828 100644
--- a/monitor/tach_sensor.cpp
+++ b/monitor/tach_sensor.cpp
@@ -38,6 +38,8 @@
constexpr auto FAN_TARGET_PROPERTY = "Target";
constexpr auto FAN_VALUE_PROPERTY = "Value";
+constexpr auto MAX_PREV_TACHS = 8;
+constexpr auto MAX_PREV_TARGETS = 8;
namespace fs = std::filesystem;
using InternalFailure =
@@ -88,6 +90,13 @@
// Query functional state from inventory
// TODO - phosphor-fan-presence/issues/25
+ _prevTachs.resize(MAX_PREV_TACHS);
+
+ if (_hasTarget)
+ {
+ _prevTargets.resize(MAX_PREV_TARGETS);
+ }
+
_functional = true;
try
@@ -177,7 +186,20 @@
if (_hasTarget)
{
readProperty(_interface, FAN_TARGET_PROPERTY, _name, _bus, _tachTarget);
+
+ // record previous target value
+ if (_prevTargets.front() != _tachTarget)
+ {
+ _prevTargets.push_front(_tachTarget);
+
+ _prevTargets.pop_back();
+ }
}
+
+ // record previous tach value
+ _prevTachs.push_front(_tachInput);
+
+ _prevTachs.pop_back();
}
std::string TachSensor::getMatchString(const std::string& interface)
@@ -277,6 +299,14 @@
// Check all tach sensors on the fan against the target
_fan.tachChanged();
+
+ // record previous target value
+ if (_prevTargets.front() != _tachTarget)
+ {
+ _prevTargets.push_front(_tachTarget);
+
+ _prevTargets.pop_back();
+ }
}
void TachSensor::handleTachChange(sdbusplus::message::message& msg)
@@ -286,6 +316,11 @@
// Check just this sensor against the target
_fan.tachChanged(*this);
+
+ // record previous tach value
+ _prevTachs.push_front(_tachInput);
+
+ _prevTachs.pop_back();
}
void TachSensor::startTimer(TimerMode mode)