monitor: Add journal traces on tach sensor timer state changes
There have been some instances observed that look to be BMC timing
issues where fans are being marked nonfunctional with valid input
speeds. It seems as though either the signal for the valid tach input is
not being received prior to the timer used to mark a fan nonfunctional
expires. These journal traces will help denote when the timer is
started(and stopped) for when a fan is found to be out of range.
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Change-Id: I5a7957e1fd8ce3b39979af7d0dfb16279ff6315d
diff --git a/monitor/tach_sensor.cpp b/monitor/tach_sensor.cpp
index 0e30a10..605aff5 100644
--- a/monitor/tach_sensor.cpp
+++ b/monitor/tach_sensor.cpp
@@ -209,8 +209,15 @@
void TachSensor::startTimer(TimerMode mode)
{
+ using namespace std::chrono;
+
if (!timerRunning() || mode != _timerMode)
{
+ log<level::INFO>(
+ fmt::format("Start timer({}) on tach sensor {}. [delay = {}s]",
+ mode, _name,
+ duration_cast<seconds>(getDelay(mode)).count())
+ .c_str());
_timer.restartOnce(getDelay(mode));
_timerMode = mode;
}
diff --git a/monitor/tach_sensor.hpp b/monitor/tach_sensor.hpp
index 4a09f17..703605a 100644
--- a/monitor/tach_sensor.hpp
+++ b/monitor/tach_sensor.hpp
@@ -1,5 +1,8 @@
#pragma once
+#include <fmt/format.h>
+
+#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server.hpp>
#include <sdeventplus/clock.hpp>
@@ -247,6 +250,9 @@
*/
inline void stopTimer()
{
+ phosphor::logging::log<phosphor::logging::level::INFO>(
+ fmt::format("Stop running timer on tach sensor {}.", _name)
+ .c_str());
_timer.setEnabled(false);
}