From 0ef1d4ce412b3aac63687b8188b5dbbf2a4afddf Mon Sep 17 00:00:00 2001 From: Shamser Ahmed Date: Mon, 23 Dec 2024 16:25:23 +0000 Subject: [PATCH] Changes following review Signed-off-by: Shamser Ahmed --- dali/base/sysinfologger.cpp | 14 +++++++++----- dali/base/sysinfologger.hpp | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/dali/base/sysinfologger.cpp b/dali/base/sysinfologger.cpp index aa3d1e61a9a..723e665dd95 100644 --- a/dali/base/sysinfologger.cpp +++ b/dali/base/sysinfologger.cpp @@ -34,7 +34,7 @@ #define ATTR_HIDDEN "@hidden" #define ATTR_SOURCE "@source" -#define NON_SYSLOGMSG_MASK 0x8000000000 +static constexpr unsigned __int64 nonSysInfoLogMsgMask = 0x80000000; static void extractDate(timestamp_type ts, unsigned & year, unsigned & month, unsigned & day) { @@ -45,7 +45,11 @@ static void extractDate(timestamp_type ts, unsigned & year, unsigned & month, un unsigned __int64 makeMessageId(unsigned year, unsigned month, unsigned day, unsigned seqN, bool nonSysInfoLogMsg) { - return (nonSysInfoLogMsg?NON_SYSLOGMSG_MASK:0) | seqN<<21 | year<<9 | month<<5 | day; + // bits 0-4 = day, bits 5-8 = month, bits 9-23 = year + // bit 24-30 unused + // bit 31 = (flag) unset means SysInfoLogger managed message, set means message managed elsewhere + // bits 32-63 = sequence number + return seqN<<32 | (nonSysInfoLogMsg?nonSysInfoLogMsgMask:0) | year<<9 | month<<5 | day; } unsigned __int64 makeMessageId(unsigned __int64 ts, unsigned seqN, bool nonSysInfoLogMsg) @@ -59,9 +63,9 @@ static bool decodeMessageId(unsigned __int64 msgId, unsigned & year, unsigned & { day = msgId & 0x1F; month = (msgId>>5) & 0x0F; - year = (msgId>>9) & 0xFFF; - seqn = (msgId>>21); - return msgId & NON_SYSLOGMSG_MASK; + year = (msgId>>9) & 0x3FFF; + seqn = msgId>>32; + return msgId & nonSysInfoLogMsgMask; } class CSysInfoLoggerMsg : implements ISysInfoLoggerMsg diff --git a/dali/base/sysinfologger.hpp b/dali/base/sysinfologger.hpp index e9070c76a1e..9eb0d986e66 100644 --- a/dali/base/sysinfologger.hpp +++ b/dali/base/sysinfologger.hpp @@ -90,7 +90,7 @@ SYSINFO_API bool deleteLogSysInfoMsg(unsigned __int64 msgId, const char *source= SYSINFO_API unsigned deleteOlderThanLogSysInfoMsg(bool visibleOnly, bool hiddenOnly, unsigned year, unsigned month, unsigned day, const char *source=nullptr); /* makeMessageId - Create a message id from date, sequence number and nonSysInfoLogMsg flag to uniquely identify a message - - nonSysInfoLogMsg flag is used to identify whether or not the message managed by SysInfoLogger */ + - nonSysInfoLogMsg flag is used to identify whether or not the message is managed by SysInfoLogger */ SYSINFO_API unsigned __int64 makeMessageId(unsigned __int64 ts, unsigned seqN, bool nonSysInfoLogMsg=false); SYSINFO_API unsigned __int64 makeMessageId(unsigned year, unsigned month, unsigned day, unsigned seqN, bool nonSysInfoLogMsg=false); #endif