From bbd80db84e8ab56c6257e74ce21760a98d16b012 Mon Sep 17 00:00:00 2001 From: Claire Weinan Date: Wed, 26 Oct 2022 16:55:52 -0700 Subject: LogService: Increase dump timestamp precision This is a follow-on to "LogService: Increase Fault Log timestamp precision" [1]. Since microsecond precision timestamp support for other dump types (in addition to FaultLog) have recently been added in phosphor-debug-collector (see "Populate timestamps with microsecond precision" [2]), we now update bmcweb to expose these timestamps with microsecond precision. Dump entry "Created" timestamps are based on the "Elapsed" property of the D-Bus interface xyz.openbmc_project.Time.EpochTime [3], which is defined as time elapsed since the epoch in microseconds. Client impact: Dump entry "Created" timestamps are shown with microsecond precision instead of second precision, for entries of all dump types (not just FaultLog). Tested: Forced creation of a system dump entry from BMC console: ``` busctl call xyz.openbmc_project.Dump.Manager /xyz/openbmc_project/dump/system xyz.openbmc_project.Dump.NewDump Notify ut 1 2 ``` Retrieved the entry individually and as part of its collection: ``` curl -k -H "X-Auth-Token: $token" -X GET http://${bmc}/redfish/v1/Systems/system/LogServices/Dump/Entries/1 curl -k -H "X-Auth-Token: $token" -X GET http://${bmc}/redfish/v1/Systems/system/LogServices/Dump/Entries ``` Before change: `"Created": "2022-10-25T22:56:13+00:00",` After change: `"Created": "2022-10-25T22:56:13.271157+00:00",` Redfish Service Validator passed on the following URI trees: /redfish/v1/Managers/bmc/LogServices/Dump/Entries /redfish/v1/Managers/bmc/LogServices/FaultLog/Entries /redfish/v1/Systems/system/LogServices/Dump/Entries [1] https://github.com/openbmc/bmcweb/commit/c6fecdabd58b4c380caf1b83801ad4eb54922fff [2] https://github.com/openbmc/phosphor-debug-collector/commit/c0ab9d43d5e19123cca1a1592ee07fc064b84199 [3] https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/Time/EpochTime.interface.yaml Signed-off-by: Claire Weinan Change-Id: Ia1682d09cf196c63da7d236df31695be5a5ad34b --- redfish-core/lib/log_services.hpp | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) (limited to 'redfish-core') diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp index 5e732fb83f..92954861d6 100644 --- a/redfish-core/lib/log_services.hpp +++ b/redfish-core/lib/log_services.hpp @@ -507,25 +507,18 @@ inline void thisEntry["Id"] = entryID; thisEntry["EntryType"] = "Event"; thisEntry["Name"] = dumpType + " Dump Entry"; + thisEntry["Created"] = + redfish::time_utils::getDateTimeUintUs(timestampUs); if (dumpType == "BMC") { - thisEntry["Created"] = redfish::time_utils::getDateTimeUint( - timestampUs / 1000 / 1000); thisEntry["DiagnosticDataType"] = "Manager"; thisEntry["AdditionalDataURI"] = entriesPath + entryID + "/attachment"; thisEntry["AdditionalDataSizeBytes"] = size; } - else if (dumpType == "FaultLog") - { - thisEntry["Created"] = - redfish::time_utils::getDateTimeUintUs(timestampUs); - } else if (dumpType == "System") { - thisEntry["Created"] = redfish::time_utils::getDateTimeUint( - timestampUs / 1000 / 1000); thisEntry["DiagnosticDataType"] = "OEM"; thisEntry["OEMDiagnosticDataType"] = "System"; thisEntry["AdditionalDataURI"] = @@ -599,27 +592,18 @@ inline void asyncResp->res.jsonValue["Id"] = entryID; asyncResp->res.jsonValue["EntryType"] = "Event"; asyncResp->res.jsonValue["Name"] = dumpType + " Dump Entry"; + asyncResp->res.jsonValue["Created"] = + redfish::time_utils::getDateTimeUintUs(timestampUs); if (dumpType == "BMC") { - asyncResp->res.jsonValue["Created"] = - redfish::time_utils::getDateTimeUint(timestampUs / 1000 / - 1000); asyncResp->res.jsonValue["DiagnosticDataType"] = "Manager"; asyncResp->res.jsonValue["AdditionalDataURI"] = entriesPath + entryID + "/attachment"; asyncResp->res.jsonValue["AdditionalDataSizeBytes"] = size; } - else if (dumpType == "FaultLog") - { - asyncResp->res.jsonValue["Created"] = - redfish::time_utils::getDateTimeUintUs(timestampUs); - } else if (dumpType == "System") { - asyncResp->res.jsonValue["Created"] = - redfish::time_utils::getDateTimeUint(timestampUs / 1000 / - 1000); asyncResp->res.jsonValue["DiagnosticDataType"] = "OEM"; asyncResp->res.jsonValue["OEMDiagnosticDataType"] = "System"; asyncResp->res.jsonValue["AdditionalDataURI"] = -- cgit v1.2.3