Shantappa Teekappanavar | 1ac6162 | 2021-06-22 19:07:29 -0500 | [diff] [blame] | 1 | #include <unistd.h> |
| 2 | |
| 3 | #include <watchdog_dbus.hpp> |
| 4 | #include <watchdog_handler.hpp> |
| 5 | #include <watchdog_logging.hpp> |
| 6 | |
| 7 | namespace watchdog |
| 8 | { |
| 9 | namespace dump |
| 10 | { |
| 11 | |
| 12 | /** |
| 13 | * @brief Log an event handled by the dump handler |
| 14 | * |
| 15 | * @param additional - Additional PEL data |
| 16 | * @param timeout - timeout interval in seconds |
| 17 | */ |
| 18 | void event(std::map<std::string, std::string>& additional, |
| 19 | const uint32_t timeout) |
| 20 | { |
| 21 | |
| 22 | std::string eventName = "org.open_power.Host.Boot.Error.WatchdogTimeout"; |
| 23 | |
| 24 | // CreatePELWithFFDCFiles requires a vector of FFDCTuple. |
| 25 | auto emptyFfdc = std::vector<FFDCTuple>{}; |
| 26 | |
| 27 | // Create PEL with additional data. |
| 28 | auto pelId = createPel(eventName, additional, emptyFfdc); |
| 29 | |
| 30 | requestDump(pelId, timeout); // will not return until dump is complete |
| 31 | } |
| 32 | |
| 33 | void eventWatchdogTimeout(const uint32_t timeout) |
| 34 | { |
| 35 | // Additional data to be added to PEL object |
| 36 | // Currently we don't have anything to add |
| 37 | // Keeping this for now in case if we have to add |
| 38 | // any data corresponding to watchdog timeout |
| 39 | std::map<std::string, std::string> additionalData; |
| 40 | event(additionalData, timeout); |
| 41 | } |
| 42 | |
| 43 | } // namespace dump |
| 44 | } // namespace watchdog |