gpio-health-monitor :Add support to track event count
Added 0004-Add-support-to-track-event-counts.patch
- support to track unhealthy event counts
Tested:
Details in the patch
Fusion-Link: fusion2 N/A
Google-Bug-Id: 427175539
Change-Id: I1ca97ec0a5b3e9bc531be04c771d8b77af6e83f2
Signed-off-by: Vikram Gara <vikramgara@google.com>
diff --git a/recipes-phosphor/gpio/health-monitor/0004-Add-support-to-track-event-counts.patch b/recipes-phosphor/gpio/health-monitor/0004-Add-support-to-track-event-counts.patch
new file mode 100644
index 0000000..71f2e2b
--- /dev/null
+++ b/recipes-phosphor/gpio/health-monitor/0004-Add-support-to-track-event-counts.patch
@@ -0,0 +1,80 @@
+From b9a094d3ff1fa389933b4d32a677eee044715091 Mon Sep 17 00:00:00 2001
+From: Vikram Gara <vikramgara@google.com>
+Date: Tue, 9 Sep 2025 18:11:41 +0000
+Subject: [PATCH] Add support to track event counts
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+ This change adds support for a count variable that increments
+ each time an unhealthy event is detected, allowing for tracking
+ the frequency of such events.
+
+Tested:
+ ```
+1. root@xxx:/# busctl introspect xyz.openbmc_project.HealthMonitor /xyz/openbmc_project/HealthMonitor/p1_thermal_trip 18:44:38 [29/248]
+2. NAME TYPE SIGNATURE RESULT/VALUE FLAGS
+3. org.freedesktop.DBus.Introspectable interface - - -
+4. .Introspect method - s -
+5. org.freedesktop.DBus.Peer interface - - -
+6. .GetMachineId method - s -
+7. .Ping method - - -
+8. org.freedesktop.DBus.Properties interface - - -
+9. .Get method ss v -
+10. .GetAll method s a{sv} -
+11. .Set method ssv - -
+12. .PropertiesChanged signal sa{sv}as - -
+13. xyz.openbmc_project.HealthMonitor.GetStatus interface - - -
+14. .updateHealthStatus method b - -
+15. .unhealthyCount property t 1 emits-change writable
+16. .healthy property b false emits-change writable
+17. .toggle_count property t 2 emits-change writable
+18. .healthyPropertyChanged signal s -
+```
+Signed-off-by: Vikram Gara <vikramgara@google.com>
+---
+ gpioHealthMonMain.cpp | 5 +++++
+ .../openbmc_project/HealthMonitor/GetStatus.interface.yaml | 5 +++++
+ 2 files changed, 10 insertions(+)
+
+diff --git a/gpioHealthMonMain.cpp b/gpioHealthMonMain.cpp
+index f26dc75..f38af1d 100644
+--- a/gpioHealthMonMain.cpp
++++ b/gpioHealthMonMain.cpp
+@@ -73,12 +73,17 @@ class GetStatus : GetStatus_inherit
+ {
+ GetStatus::healthy(healthy);
+ GetStatus::toggleCount(0);
++ GetStatus::unhealthyCount(0);
+ }
+
+ void updateHealthStatus(bool newHealthyStatus) override
+ {
+ healthy(newHealthyStatus);
+ toggleCount(toggleCount() + 1);
++ if (!newHealthyStatus)
++ {
++ unhealthyCount(unhealthyCount() + 1);
++ }
+ healthyPropertyChanged(entityObjPath);
+ if(toggleCount() == limit)
+ {
+diff --git a/yaml/xyz/openbmc_project/HealthMonitor/GetStatus.interface.yaml b/yaml/xyz/openbmc_project/HealthMonitor/GetStatus.interface.yaml
+index e1596ae..9d94e68 100644
+--- a/yaml/xyz/openbmc_project/HealthMonitor/GetStatus.interface.yaml
++++ b/yaml/xyz/openbmc_project/HealthMonitor/GetStatus.interface.yaml
+@@ -21,6 +21,11 @@ properties:
+ default: 0
+ description: >
+ Property indicating count of state change events. The purpose is to identify flaky signals.
++ - name: unhealthyCount
++ type: uint64
++ default: 0
++ description: >
++ Property indicating count of unhealthy state change events.
+ signals:
+ - name: healthyPropertyChanged
+ properties:
+--
+2.51.0.384.g4c02a37b29-goog
+