Re: [devel] [PATCH 1/1] dtm: improve time accuracy in a trace record [#3144]
Hi Thanh, ACK. Best regards, Peter -Original Message- From: Thanh Nguyen Sent: Friday, 24 January 2020 11:35 AM To: Peter McIntyre ; Minh Hon Chau Cc: opensaf-devel@lists.sourceforge.net; Thanh Nguyen Subject: [PATCH 1/1] dtm: improve time accuracy in a trace record [#3144] In the trace record the time value is generated after acquiring the mutex. The time accuracy is improved when generated before seizing the mutext. --- src/base/logtrace.cc| 2 +- src/base/logtrace_client.cc | 18 +- src/base/logtrace_client.h | 13 ++--- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/base/logtrace.cc b/src/base/logtrace.cc index 8908c1ff3..9822879ab 100644 --- a/src/base/logtrace.cc +++ b/src/base/logtrace.cc @@ -97,7 +97,7 @@ void trace_output(const char *file, unsigned line, unsigned priority, if (!entry) { entry = gl_local_thread_trace->CreateLogEntry( static_cast(priority), - preamble, ap); + base::ReadRealtimeClock(), preamble, ap); } gl_thread_buffer.WriteToBuffer(entry); } diff --git a/src/base/logtrace_client.cc b/src/base/logtrace_client.cc index e22112a43..484bd17e5 100644 --- a/src/base/logtrace_client.cc +++ b/src/base/logtrace_client.cc @@ -96,19 +96,26 @@ const char* LogTraceClient::Log(LogTraceClient* tracelog, const char* LogTraceClient::Log(base::LogMessage::Severity severity, const char *fmt, va_list ap) { if (log_socket_ != nullptr && log_mutex_ != nullptr) { -return LogInternal(severity, fmt, ap); +return LogInternal(severity, base::ReadRealtimeClock(), fmt, ap); } return nullptr; } const char* LogTraceClient::LogInternal(base::LogMessage::Severity severity, -const char *fmt, va_list ap) { +timespec time_spec, const char *fmt, va_list ap) { base::Lock lock(*log_mutex_); - CreateLogEntryInternal(severity, fmt, ap); + CreateLogEntryInternal(severity, time_spec, fmt, ap); log_socket_->Send(buffer_.data(), buffer_.size()); return buffer_.data(); } +const char* LogTraceClient::CreateLogEntry(base::LogMessage::Severity severity, +timespec time_spec, const char *fmt, va_list ap) { + base::Lock lock(*log_mutex_); + return CreateLogEntryInternal(severity, time_spec, fmt, ap); } + +// This is original const char* LogTraceClient::CreateLogEntry(base::LogMessage::Severity severity, const char *fmt, va_list ap) { base::Lock lock(*log_mutex_); @@ -116,12 +123,13 @@ const char* LogTraceClient::CreateLogEntry(base::LogMessage::Severity severity, } const char* LogTraceClient::CreateLogEntryInternal( -base::LogMessage::Severity severity, const char *fmt, va_list ap) { +base::LogMessage::Severity severity, timespec time_spec, +const char *fmt, va_list ap) { uint32_t id = sequence_id_; sequence_id_ = id < kMaxSequenceId ? id + 1 : 1; buffer_.clear(); base::LogMessage::Write( - base::LogMessage::Facility::kLocal1, severity, base::ReadRealtimeClock(), + base::LogMessage::Facility::kLocal1, severity, time_spec, fqdn_, app_name_, proc_id_, msg_id_, {{base::LogMessage::SdName{"meta"}, {base::LogMessage::Parameter{base::LogMessage::SdName{"sequenceId"}, diff --git a/src/base/logtrace_client.h b/src/base/logtrace_client.h index 5b165e528..29aa79b95 100644 --- a/src/base/logtrace_client.h +++ b/src/base/logtrace_client.h @@ -45,6 +45,8 @@ class LogTraceClient { va_list ap); const char* CreateLogEntry(base::LogMessage::Severity severity, const char *fmt, va_list ap); + const char* CreateLogEntry(base::LogMessage::Severity severity, + timespec time_spec, const char *fmt, va_list ap); void AddExternalBuffer(int64_t tid, LogTraceBuffer* buffer); void RemoveExternalBuffer(int64_t tid); void RequestFlushExternalBuffer(); @@ -56,10 +58,15 @@ class LogTraceClient { private: bool Init(const char *msg_id, WriteMode mode); - const char* LogInternal(base::LogMessage::Severity severity, const char *fmt, - va_list ap); + + const char* LogInternal(base::LogMessage::Severity severity, + timespec time_spec, const char *fmt, va_list ap); const char* CreateLogEntryInternal(base::LogMessage::Severity severity, - const char *fmt, va_list ap); + timespec time_spec, const char *fmt, va_list ap); inline const + char* CreateLogEntryInternal( + base::LogMessage::Severity severity, const char *fmt, va_list ap) { +return CreateLogEntryInternal(severity, base::ReadRealtimeClock(), + fmt, ap); } static constexpr const uint32_t kMaxSequenceId = uint32_t{0x7fff}; base::LogMessage::HostName fqdn_{""}; base::LogMessage::AppName app_name_{""}; -- 2.17.1 ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1/1] fmd: Do not send RDE to set active role if opensaf_quick_reboot is executed [#3146]
Hi Minh ack — From: Minh Chau Sent: Friday, January 24, 2020 11:35:29 AM To: Gary Lee Cc: opensaf-devel@lists.sourceforge.net ; Minh Hon Chau Subject: [PATCH 1/1] fmd: Do not send RDE to set active role if opensaf_quick_reboot is executed [#3146] If a SC is separated from cluster, fmd calls opensaf_quick_reboot(). The reboot script returns yet the node has not been coming down. In the code after opensaf_quick_reboot(), fmd tells rde to promote to active. Hence, there is a short period of having two 2 active SC This patch makes fmd to stop sending to RDE to set active role after opensaf_quick_reboot(). Note: There are a few places after opensaf_quick_reboot(), the function does not return. However, this patch only fixes the issue in fm, the other places will be re-visited. --- src/fm/fmd/fm_rda.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/fm/fmd/fm_rda.cc b/src/fm/fmd/fm_rda.cc index fca417f79..479eb2149 100644 --- a/src/fm/fmd/fm_rda.cc +++ b/src/fm/fmd/fm_rda.cc @@ -86,6 +86,7 @@ void promote_node(FM_CB *fm_cb) { LOG_ER("Unable to set active controller in consensus service"); opensaf_quick_reboot("Unable to set active controller " "in consensus service"); +return; } else if (rc == SA_AIS_ERR_EXIST) { // @todo if we don't reboot, we don't seem to recover from this. Can we // improve? @@ -94,6 +95,7 @@ void promote_node(FM_CB *fm_cb) { "cluster?"); opensaf_quick_reboot("A controller is already active. We were separated " "from the cluster?"); +return; } PCS_RDA_REQ rda_req; -- 2.20.1 ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 0/1] Review Request for fmd: Do not send RDE to set active role if opensaf_quick_reboot is executed [#3146]
Summary: fmd: Do not send RDE to set active role if opensaf_quick_reboot is executed [#3146] Review request for Ticket(s): 3146 Peer Reviewer(s): Gary Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE *** Affected branch(es): develop Development branch: ticket-3146 Base revision: f03fe23c17bd4e4e32dd4a1304d2ac8f247d05e7 Personal repository: git://git.code.sf.net/u/minh-chau/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesy OpenSAF servicesn Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): - *** EXPLAIN/COMMENT THE PATCH SERIES HERE *** revision 6afce8c0b7f827d5186f8a64f6229a10329d1313 Author: Minh Chau Date: Fri, 24 Jan 2020 10:57:03 +1100 fmd: Do not send RDE to set active role if opensaf_quick_reboot is executed [#3146] If a SC is separated from cluster, fmd calls opensaf_quick_reboot(). The reboot script returns yet the node has not been coming down. In the code after opensaf_quick_reboot(), fmd tells rde to promote to active. Hence, there is a short period of having two 2 active SC This patch makes fmd to stop sending to RDE to set active role after opensaf_quick_reboot(). Note: There are a few places after opensaf_quick_reboot(), the function does not return. However, this patch only fixes the issue in fm, the other places will be re-visited. Complete diffstat: -- src/fm/fmd/fm_rda.cc | 2 ++ 1 file changed, 2 insertions(+) Testing Commands: - *** LIST THE COMMAND LINE TOOLS/STEPS TO TEST YOUR CHANGES *** Testing, Expected Results: -- *** PASTE COMMAND OUTPUTS / TEST RESULTS *** Conditions of Submission: - *** HOW MANY DAYS BEFORE PUSHING, CONSENSUS ETC *** Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 y y powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates the Doxygen manual. ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 1/1] fmd: Do not send RDE to set active role if opensaf_quick_reboot is executed [#3146]
If a SC is separated from cluster, fmd calls opensaf_quick_reboot(). The reboot script returns yet the node has not been coming down. In the code after opensaf_quick_reboot(), fmd tells rde to promote to active. Hence, there is a short period of having two 2 active SC This patch makes fmd to stop sending to RDE to set active role after opensaf_quick_reboot(). Note: There are a few places after opensaf_quick_reboot(), the function does not return. However, this patch only fixes the issue in fm, the other places will be re-visited. --- src/fm/fmd/fm_rda.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/fm/fmd/fm_rda.cc b/src/fm/fmd/fm_rda.cc index fca417f79..479eb2149 100644 --- a/src/fm/fmd/fm_rda.cc +++ b/src/fm/fmd/fm_rda.cc @@ -86,6 +86,7 @@ void promote_node(FM_CB *fm_cb) { LOG_ER("Unable to set active controller in consensus service"); opensaf_quick_reboot("Unable to set active controller " "in consensus service"); +return; } else if (rc == SA_AIS_ERR_EXIST) { // @todo if we don't reboot, we don't seem to recover from this. Can we // improve? @@ -94,6 +95,7 @@ void promote_node(FM_CB *fm_cb) { "cluster?"); opensaf_quick_reboot("A controller is already active. We were separated " "from the cluster?"); +return; } PCS_RDA_REQ rda_req; -- 2.20.1 ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 1/1] dtm: improve time accuracy in a trace record [#3144]
In the trace record the time value is generated after acquiring the mutex. The time accuracy is improved when generated before seizing the mutext. --- src/base/logtrace.cc| 2 +- src/base/logtrace_client.cc | 18 +- src/base/logtrace_client.h | 13 ++--- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/base/logtrace.cc b/src/base/logtrace.cc index 8908c1ff3..9822879ab 100644 --- a/src/base/logtrace.cc +++ b/src/base/logtrace.cc @@ -97,7 +97,7 @@ void trace_output(const char *file, unsigned line, unsigned priority, if (!entry) { entry = gl_local_thread_trace->CreateLogEntry( static_cast(priority), - preamble, ap); + base::ReadRealtimeClock(), preamble, ap); } gl_thread_buffer.WriteToBuffer(entry); } diff --git a/src/base/logtrace_client.cc b/src/base/logtrace_client.cc index e22112a43..484bd17e5 100644 --- a/src/base/logtrace_client.cc +++ b/src/base/logtrace_client.cc @@ -96,19 +96,26 @@ const char* LogTraceClient::Log(LogTraceClient* tracelog, const char* LogTraceClient::Log(base::LogMessage::Severity severity, const char *fmt, va_list ap) { if (log_socket_ != nullptr && log_mutex_ != nullptr) { -return LogInternal(severity, fmt, ap); +return LogInternal(severity, base::ReadRealtimeClock(), fmt, ap); } return nullptr; } const char* LogTraceClient::LogInternal(base::LogMessage::Severity severity, -const char *fmt, va_list ap) { +timespec time_spec, const char *fmt, va_list ap) { base::Lock lock(*log_mutex_); - CreateLogEntryInternal(severity, fmt, ap); + CreateLogEntryInternal(severity, time_spec, fmt, ap); log_socket_->Send(buffer_.data(), buffer_.size()); return buffer_.data(); } +const char* LogTraceClient::CreateLogEntry(base::LogMessage::Severity severity, +timespec time_spec, const char *fmt, va_list ap) { + base::Lock lock(*log_mutex_); + return CreateLogEntryInternal(severity, time_spec, fmt, ap); +} + +// This is original const char* LogTraceClient::CreateLogEntry(base::LogMessage::Severity severity, const char *fmt, va_list ap) { base::Lock lock(*log_mutex_); @@ -116,12 +123,13 @@ const char* LogTraceClient::CreateLogEntry(base::LogMessage::Severity severity, } const char* LogTraceClient::CreateLogEntryInternal( -base::LogMessage::Severity severity, const char *fmt, va_list ap) { +base::LogMessage::Severity severity, timespec time_spec, +const char *fmt, va_list ap) { uint32_t id = sequence_id_; sequence_id_ = id < kMaxSequenceId ? id + 1 : 1; buffer_.clear(); base::LogMessage::Write( - base::LogMessage::Facility::kLocal1, severity, base::ReadRealtimeClock(), + base::LogMessage::Facility::kLocal1, severity, time_spec, fqdn_, app_name_, proc_id_, msg_id_, {{base::LogMessage::SdName{"meta"}, {base::LogMessage::Parameter{base::LogMessage::SdName{"sequenceId"}, diff --git a/src/base/logtrace_client.h b/src/base/logtrace_client.h index 5b165e528..29aa79b95 100644 --- a/src/base/logtrace_client.h +++ b/src/base/logtrace_client.h @@ -45,6 +45,8 @@ class LogTraceClient { va_list ap); const char* CreateLogEntry(base::LogMessage::Severity severity, const char *fmt, va_list ap); + const char* CreateLogEntry(base::LogMessage::Severity severity, + timespec time_spec, const char *fmt, va_list ap); void AddExternalBuffer(int64_t tid, LogTraceBuffer* buffer); void RemoveExternalBuffer(int64_t tid); void RequestFlushExternalBuffer(); @@ -56,10 +58,15 @@ class LogTraceClient { private: bool Init(const char *msg_id, WriteMode mode); - const char* LogInternal(base::LogMessage::Severity severity, const char *fmt, - va_list ap); + + const char* LogInternal(base::LogMessage::Severity severity, + timespec time_spec, const char *fmt, va_list ap); const char* CreateLogEntryInternal(base::LogMessage::Severity severity, - const char *fmt, va_list ap); + timespec time_spec, const char *fmt, va_list ap); + inline const char* CreateLogEntryInternal( + base::LogMessage::Severity severity, const char *fmt, va_list ap) { +return CreateLogEntryInternal(severity, base::ReadRealtimeClock(), fmt, ap); + } static constexpr const uint32_t kMaxSequenceId = uint32_t{0x7fff}; base::LogMessage::HostName fqdn_{""}; base::LogMessage::AppName app_name_{""}; -- 2.17.1 ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 0/1] Review Request for dtm: improve time value in a trace record [#3144]
Summary: dtm: improve time accuracy in a trace record [#3144] Review request for Ticket(s): 3144 Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE *** Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE *** Affected branch(es): develop Development branch: ticket-3144 Base revision: f03fe23c17bd4e4e32dd4a1304d2ac8f247d05e7 Personal repository: git://git.code.sf.net/u/xdtthng/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesn OpenSAF servicesn Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): - *** EXPLAIN/COMMENT THE PATCH SERIES HERE *** revision ed3466d17c9df07b54cd801177f20743c1b398f5 Author: Thanh Nguyen Date: Fri, 24 Jan 2020 11:22:41 +1100 dtm: improve time accuracy in a trace record [#3144] In the trace record the time value is generated after acquiring the mutex. The time accuracy is improved when generated before seizing the mutext. Complete diffstat: -- src/base/logtrace.cc| 2 +- src/base/logtrace_client.cc | 18 +- src/base/logtrace_client.h | 13 ++--- 3 files changed, 24 insertions(+), 9 deletions(-) Testing Commands: - *** LIST THE COMMAND LINE TOOLS/STEPS TO TEST YOUR CHANGES *** Testing, Expected Results: -- *** PASTE COMMAND OUTPUTS / TEST RESULTS *** Conditions of Submission: - *** HOW MANY DAYS BEFORE PUSHING, CONSENSUS ETC *** Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 n n powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates the Doxygen manual. ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 0/1] Review Request for dtm: improve time value in a trace record [#314
Summary: dtm: improve time value in a trace record [#3144] Review request for Ticket(s): 3144 Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE *** Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE *** Affected branch(es): develop Development branch: ticket-3144 Base revision: f03fe23c17bd4e4e32dd4a1304d2ac8f247d05e7 Personal repository: git://git.code.sf.net/u/xdtthng/review Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesn OpenSAF servicesn Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): - *** EXPLAIN/COMMENT THE PATCH SERIES HERE *** revision 3122e85c2c54e467dbbdba04acfbfce7c46c9c17 Author: Thanh Nguyen Date: Thu, 23 Jan 2020 17:00:17 +1100 dtm: improve time value in a trace record [#3144] In the trace record the time value is generated after acquiring the mutex. The time value is improved when generated before seizing the mutext. Complete diffstat: -- src/base/logtrace.cc| 2 +- src/base/logtrace_client.cc | 18 +- src/base/logtrace_client.h | 13 ++--- 3 files changed, 24 insertions(+), 9 deletions(-) Testing Commands: - *** LIST THE COMMAND LINE TOOLS/STEPS TO TEST YOUR CHANGES *** Testing, Expected Results: -- *** PASTE COMMAND OUTPUTS / TEST RESULTS *** Conditions of Submission: - *** HOW MANY DAYS BEFORE PUSHING, CONSENSUS ETC *** Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 n n powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates the Doxygen manual. ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 1/1] dtm: improve time value in a trace record [#3144]
In the trace record the time value is generated after acquiring the mutex. The time value is improved when generated before seizing the mutext. --- src/base/logtrace.cc| 2 +- src/base/logtrace_client.cc | 18 +- src/base/logtrace_client.h | 13 ++--- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/base/logtrace.cc b/src/base/logtrace.cc index 8908c1ff3..9822879ab 100644 --- a/src/base/logtrace.cc +++ b/src/base/logtrace.cc @@ -97,7 +97,7 @@ void trace_output(const char *file, unsigned line, unsigned priority, if (!entry) { entry = gl_local_thread_trace->CreateLogEntry( static_cast(priority), - preamble, ap); + base::ReadRealtimeClock(), preamble, ap); } gl_thread_buffer.WriteToBuffer(entry); } diff --git a/src/base/logtrace_client.cc b/src/base/logtrace_client.cc index e22112a43..903e239e3 100644 --- a/src/base/logtrace_client.cc +++ b/src/base/logtrace_client.cc @@ -96,19 +96,26 @@ const char* LogTraceClient::Log(LogTraceClient* tracelog, const char* LogTraceClient::Log(base::LogMessage::Severity severity, const char *fmt, va_list ap) { if (log_socket_ != nullptr && log_mutex_ != nullptr) { -return LogInternal(severity, fmt, ap); +return LogInternal(severity, base::ReadRealtimeClock(), fmt, ap); } return nullptr; } const char* LogTraceClient::LogInternal(base::LogMessage::Severity severity, -const char *fmt, va_list ap) { +struct timespec time_spec, const char *fmt, va_list ap) { base::Lock lock(*log_mutex_); - CreateLogEntryInternal(severity, fmt, ap); + CreateLogEntryInternal(severity, time_spec, fmt, ap); log_socket_->Send(buffer_.data(), buffer_.size()); return buffer_.data(); } +const char* LogTraceClient::CreateLogEntry(base::LogMessage::Severity severity, +struct timespec time_spec, const char *fmt, va_list ap) { + base::Lock lock(*log_mutex_); + return CreateLogEntryInternal(severity, time_spec, fmt, ap); +} + +// This is original const char* LogTraceClient::CreateLogEntry(base::LogMessage::Severity severity, const char *fmt, va_list ap) { base::Lock lock(*log_mutex_); @@ -116,12 +123,13 @@ const char* LogTraceClient::CreateLogEntry(base::LogMessage::Severity severity, } const char* LogTraceClient::CreateLogEntryInternal( -base::LogMessage::Severity severity, const char *fmt, va_list ap) { +base::LogMessage::Severity severity, struct timespec time_spec, +const char *fmt, va_list ap) { uint32_t id = sequence_id_; sequence_id_ = id < kMaxSequenceId ? id + 1 : 1; buffer_.clear(); base::LogMessage::Write( - base::LogMessage::Facility::kLocal1, severity, base::ReadRealtimeClock(), + base::LogMessage::Facility::kLocal1, severity, time_spec, fqdn_, app_name_, proc_id_, msg_id_, {{base::LogMessage::SdName{"meta"}, {base::LogMessage::Parameter{base::LogMessage::SdName{"sequenceId"}, diff --git a/src/base/logtrace_client.h b/src/base/logtrace_client.h index 5b165e528..3c264f0b5 100644 --- a/src/base/logtrace_client.h +++ b/src/base/logtrace_client.h @@ -45,6 +45,8 @@ class LogTraceClient { va_list ap); const char* CreateLogEntry(base::LogMessage::Severity severity, const char *fmt, va_list ap); + const char* CreateLogEntry(base::LogMessage::Severity severity, + struct timespec time_spec, const char *fmt, va_list ap); void AddExternalBuffer(int64_t tid, LogTraceBuffer* buffer); void RemoveExternalBuffer(int64_t tid); void RequestFlushExternalBuffer(); @@ -56,10 +58,15 @@ class LogTraceClient { private: bool Init(const char *msg_id, WriteMode mode); - const char* LogInternal(base::LogMessage::Severity severity, const char *fmt, - va_list ap); + + const char* LogInternal(base::LogMessage::Severity severity, + struct timespec time_spec, const char *fmt, va_list ap); const char* CreateLogEntryInternal(base::LogMessage::Severity severity, - const char *fmt, va_list ap); + struct timespec time_spec, const char *fmt, va_list ap); + inline const char* CreateLogEntryInternal( + base::LogMessage::Severity severity, const char *fmt, va_list ap) { +return CreateLogEntryInternal(severity, base::ReadRealtimeClock(), fmt, ap); + } static constexpr const uint32_t kMaxSequenceId = uint32_t{0x7fff}; base::LogMessage::HostName fqdn_{""}; base::LogMessage::AppName app_name_{""}; -- 2.17.1 ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel