[devel] [PATCH 1/1] dtm: improve time accuracy in a trace record [#3144]

2020-02-05 Thread Thanh Nguyen
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 | 15 ---
 src/base/logtrace_client.h  |  9 +
 3 files changed, 14 insertions(+), 12 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..104e08ce1 100644
--- a/src/base/logtrace_client.cc
+++ b/src/base/logtrace_client.cc
@@ -96,32 +96,33 @@ 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,
-const char *fmt, va_list ap) {
+timespec time_spec, const char *fmt, va_list ap) {
   base::Lock lock(*log_mutex_);
-  return CreateLogEntryInternal(severity, fmt, ap);
+  return CreateLogEntryInternal(severity, time_spec, fmt, ap);
 }
 
 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..1ccb44d06 100644
--- a/src/base/logtrace_client.h
+++ b/src/base/logtrace_client.h
@@ -44,7 +44,7 @@ class LogTraceClient {
   const char* Log(base::LogMessage::Severity severity, const char *fmt,
   va_list ap);
   const char* CreateLogEntry(base::LogMessage::Severity severity,
-  const char *fmt, va_list ap);
+  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 +56,11 @@ 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);
   static constexpr const uint32_t kMaxSequenceId = uint32_t{0x7fff};
   base::LogMessage::HostName fqdn_{""};
   base::LogMessage::AppName app_name_{""};
-- 
2.25.0



___
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 accuracy in a trace record [#3144]

2020-02-05 Thread Thanh Nguyen
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: 813ef8f3d514f321fae254ffdaca5eb1991dbbbd
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 b02569e50913fa8697ba087b25b3accae2b0069e
Author: Thanh Nguyen 
Date:   Thu, 6 Feb 2020 15:30:09 +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 | 15 ---
 src/base/logtrace_client.h  |  9 +
 3 files changed, 14 insertions(+), 12 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 accuracy in a trace record [#3144]

2020-02-05 Thread Thanh Nguyen
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: 813ef8f3d514f321fae254ffdaca5eb1991dbbbd
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 3a7d9c5f43233124cb866c4b4e9076cbcd5417b8
Author: Thanh Nguyen 
Date:   Thu, 6 Feb 2020 15:16:37 +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 | 17 ++---
 src/base/logtrace_client.h  |  9 +
 3 files changed, 16 insertions(+), 12 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 accuracy in a trace record [#3144]

2020-02-05 Thread Thanh Nguyen
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 | 17 ++---
 src/base/logtrace_client.h  |  9 +
 3 files changed, 16 insertions(+), 12 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..1f3dfe721 100644
--- a/src/base/logtrace_client.cc
+++ b/src/base/logtrace_client.cc
@@ -96,32 +96,35 @@ 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,
-const char *fmt, va_list ap) {
+timespec time_spec, const char *fmt, va_list ap) {
   base::Lock lock(*log_mutex_);
-  return CreateLogEntryInternal(severity, fmt, ap);
+  return CreateLogEntryInternal(severity, time_spec, fmt, ap);
 }
 
+// This is original
+
 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..1ccb44d06 100644
--- a/src/base/logtrace_client.h
+++ b/src/base/logtrace_client.h
@@ -44,7 +44,7 @@ class LogTraceClient {
   const char* Log(base::LogMessage::Severity severity, const char *fmt,
   va_list ap);
   const char* CreateLogEntry(base::LogMessage::Severity severity,
-  const char *fmt, va_list ap);
+  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 +56,11 @@ 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);
   static constexpr const uint32_t kMaxSequenceId = uint32_t{0x7fff};
   base::LogMessage::HostName fqdn_{""};
   base::LogMessage::AppName app_name_{""};
-- 
2.25.0



___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1/1] dtm: improve time accuracy in a trace record [#3144]

2020-02-05 Thread Minh Hon Chau

Hi aThanh,

The CreateLogEntry/... are added recently in LogTraceClient.h/cc, and 
the "client" you mean should have been calling the log/trace in 
logtrace.h, which are the OpenSAF services and agents. The real client 
should include the SAF headers in src/ais/include to use SAF services.


Do you see any use cases that "client" should include LogTraceClient.h 
to call CreateLogEntry without logtrace.h?


Thanks, Minh

On 6/2/20 2:05 pm, Thanh Nguyen wrote:

Hello Minh,

1) For LogInternal(..), there is only one version. The new replaced the old. 
This is private method, thus it can be safely replaced.
2) For CreateLogEntry(...) which is a public method. For compatibility reasons, 
I keep the old method and create the new method. I do not know if there is any 
client code of opensaf out there calling CreateLogEntry. If it is known that 
there is no client code, I will remove the old method.

3) For CreateLogEntryInternal(..), I also keep two versions corresponding to 
two versions of calling methods CreateLogEntry(..).

I will remove the old version of (2) and (3) if it is confirmed that there is 
no client code calling CreateLogEntry(..).
Best Regards,
Thanh

-Original Message-
From: Minh Hon Chau [mailto:minh.c...@dektech.com.au]
Sent: Thursday, 6 February 2020 12:48 PM
To: Thanh Nguyen; peter.mcint...@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 1/1] dtm: improve time accuracy in a trace record [#3144]

Hi aThanh,

The patch adds a new pair of CreateLogEntry/CreateLogEntryInternal with
one extra parameter. If the old one (within 3 parameters) is not being
used anywhere else, we can delete them.

Thanks

Minh

On 24/1/20 11:34 am, Thanh Nguyen wrote:

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);
 c

Re: [devel] [PATCH 1/1] dtm: improve time accuracy in a trace record [#3144]

2020-02-05 Thread Thanh Nguyen
Hello Minh,

1) For LogInternal(..), there is only one version. The new replaced the old. 
This is private method, thus it can be safely replaced.
2) For CreateLogEntry(...) which is a public method. For compatibility reasons, 
I keep the old method and create the new method. I do not know if there is any 
client code of opensaf out there calling CreateLogEntry. If it is known that 
there is no client code, I will remove the old method.

3) For CreateLogEntryInternal(..), I also keep two versions corresponding to 
two versions of calling methods CreateLogEntry(..).

I will remove the old version of (2) and (3) if it is confirmed that there is 
no client code calling CreateLogEntry(..).
Best Regards,
Thanh

-Original Message-
From: Minh Hon Chau [mailto:minh.c...@dektech.com.au] 
Sent: Thursday, 6 February 2020 12:48 PM
To: Thanh Nguyen; peter.mcint...@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 1/1] dtm: improve time accuracy in a trace record [#3144]

Hi aThanh,

The patch adds a new pair of CreateLogEntry/CreateLogEntryInternal with 
one extra parameter. If the old one (within 3 parameters) is not being 
used anywhere else, we can delete them.

Thanks

Minh

On 24/1/20 11:34 am, Thanh Nguyen wrote:
> 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

Re: [devel] [PATCH 1/1] dtm: improve time accuracy in a trace record [#3144]

2020-02-05 Thread Minh Hon Chau

Hi aThanh,

The patch adds a new pair of CreateLogEntry/CreateLogEntryInternal with 
one extra parameter. If the old one (within 3 parameters) is not being 
used anywhere else, we can delete them.


Thanks

Minh

On 24/1/20 11:34 am, Thanh Nguyen wrote:

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_{""};



___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 2/2] lck: fully support SC absence [#3092]

2020-02-05 Thread Mathi N P
Ack with a comment below:
It is arguable that one second is a big delay interval. How are the other
services handling this?
+ if (error == SA_AIS_ERR_TIMEOUT || error == SA_AIS_ERR_TRY_AGAIN) {
+ redo = true;
+ printf("lockGrantCallbackNoResources received timeout/tryagain\n");
+ sleep(1);

Cheers,
Mathi.

On Mon, Jan 27, 2020 at 5:29 PM Jones, Alex  wrote:

> fix whitespace error
> ---
> src/lck/apitest/test_saLckLimitGet.cc | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/lck/apitest/test_saLckLimitGet.cc
> b/src/lck/apitest/test_saLckLimitGet.cc
> index f3e7bc05d..bb77b696a 100644
> --- a/src/lck/apitest/test_saLckLimitGet.cc
> +++ b/src/lck/apitest/test_saLckLimitGet.cc
> @@ -45,7 +45,7 @@ SaAisErrorT lockResourceOpen(SaLckHandleT lckHandle,
> SaLckResourceHandleT& lockResourceHandle)
> {
> SaAisErrorT rc(SA_AIS_OK);
> -
> +
> while (true) {
> rc = saLckResourceOpen(lckHandle,
> &name,
> @@ -68,7 +68,7 @@ SaAisErrorT lockResourceOpenAsync(SaLckHandleT lckHandle,
> SaLckResourceOpenFlagsT flags)
> {
> SaAisErrorT rc(SA_AIS_OK);
> -
> +
> while (true) {
> rc = saLckResourceOpenAsync(lckHandle, invocation, &name, flags);
>
> --
> 2.21.1
>
>
> --
> Notice: This e-mail together with any attachments may contain information
> of Ribbon Communications Inc. that is confidential and/or proprietary for
> the sole use of the intended recipient. Any review, disclosure, reliance or
> distribution by others or forwarding without express permission is strictly
> prohibited. If you are not the intended recipient, please notify the sender
> immediately and then delete all copies, including any attachments.
> --
>

___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel