zone: Add debug thermal/power interface
- Add xyz.openbmc_project.Debug.Pid.ThermalPower interface to
fanctrl/zoneX/pid dbus to record some datas in thermal/power
PID loop.
Tested:
```
busctl introspect xyz.openbmc_project.State.FanCtrl /xyz/openbmc_project/settings/fanctrl/zone0/CPU0_PID xyz.openbmc_project.Debug.Pid.ThermalPower
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
.ClassType property s "Temperature" emits-change
.Input property d 36.594 emits-change
.Leader property s "Die_CPU0" emits-change
.Output property d 4200 emits-change
.Setpoint property d 70 emits-change
```
Signed-off-by: Harvey Wu <Harvey.Wu@quantatw.com>
Change-Id: I6846c3878c2ca5eaeeb6eaf48aaf0f604a2beccf
diff --git a/pid/thermalcontroller.cpp b/pid/thermalcontroller.cpp
index db4763f..357437b 100644
--- a/pid/thermalcontroller.cpp
+++ b/pid/thermalcontroller.cpp
@@ -101,6 +101,8 @@
throw ControllerBuildException("Unrecognized ThermalType");
}
+ std::string leaderName = *(_inputs.begin());
+
bool acceptable = false;
for (const auto& in : _inputs)
{
@@ -112,6 +114,8 @@
continue;
}
+ double oldValue = value;
+
if (doSummation)
{
value += cachedValue;
@@ -121,6 +125,12 @@
value = compare(value, cachedValue);
}
+ if (oldValue != value)
+ {
+ leaderName = in;
+ _owner->updateThermalPowerDebugInterface(_id, leaderName, value, 0);
+ }
+
acceptable = true;
}
@@ -133,7 +143,7 @@
if (debugEnabled)
{
std::cerr << getID() << " choose the temperature value: " << value
- << "\n";
+ << " " << leaderName << "\n";
}
return value;
@@ -162,6 +172,7 @@
void ThermalController::outputProc(double value)
{
_owner->addSetPoint(value, _id);
+ _owner->updateThermalPowerDebugInterface(_id, "", 0, value);
if (debugEnabled)
{