Add debug mode
Description:
1. Could enable debug mode by adding file: /etc/thermal.d/debugging.
$ mkdir /etc/thermal.d
$ touch /etc/thermal.d/debugging
$ systemctl restart phosphor-pid-control
2. Could record fans output PWM, chosen temperature, PID/stepwise output PWM in debug mode.
Design:
1. Create debugging file and restart service to enable debug mode.
2. Check if debug mode is enabled to output fans output PWM, chosen temperature,
PID/stepwise output PWM, and so on.
Test Case:
1. Enable debug mode and check logs: pass
Change-Id: I8527ebcb81e723298ba7e786b4501f986ebd439e
Signed-off-by: Bonnie Lo <Bonnie_Lo@wiwynn.com>
diff --git a/pid/stepwisecontroller.cpp b/pid/stepwisecontroller.cpp
index 5c36778..d141f87 100644
--- a/pid/stepwisecontroller.cpp
+++ b/pid/stepwisecontroller.cpp
@@ -18,6 +18,7 @@
#include "ec/stepwise.hpp"
#include "errors/exception.hpp"
+#include "tuning.hpp"
#include "util.hpp"
#include "zone.hpp"
@@ -90,6 +91,13 @@
{
value = std::max(value, _owner->getCachedValue(in));
}
+
+ if (debugEnabled)
+ {
+ std::cerr << getID()
+ << " choose the maximum temperature value: " << value << "\n";
+ }
+
return value;
}
@@ -102,6 +110,10 @@
else
{
_owner->addSetPoint(value, _id);
+ if (debugEnabled)
+ {
+ std::cerr << getID() << " stepwise output pwm: " << value << "\n";
+ }
}
return;
}