[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - comphelper/source include/comphelper

Tor Lillqvist (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 29 08:38:18 UTC 2021


 comphelper/source/misc/traceevent.cxx |    2 --
 include/comphelper/profilezone.hxx    |   14 ++++++--------
 2 files changed, 6 insertions(+), 10 deletions(-)

New commits:
commit 2f5c9ab2c95c6489121206a56da7e76d6fc745d8
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Tue Apr 27 11:14:07 2021 +0300
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Thu Apr 29 10:37:41 2021 +0200

    Make the console logging in ProfileZone work more sanely
    
    Do not re-assing a value to the m_nCreateTime if bConsole is true.
    Just use the same code that sets it in the constructor as in the case
    when recording is on.
    
    Change-Id: I1ca3c5aa00e2f8f0faa7ca3433e1eb066413c2a2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114794
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>

diff --git a/comphelper/source/misc/traceevent.cxx b/comphelper/source/misc/traceevent.cxx
index 6e86c3f03993..325ba59b131d 100644
--- a/comphelper/source/misc/traceevent.cxx
+++ b/comphelper/source/misc/traceevent.cxx
@@ -120,8 +120,6 @@ void ProfileZone::addRecording()
                              + OUString::number(osl_getThreadIdentifier(nullptr)) + "},");
 }
 
-void ProfileZone::startConsole() { m_nCreateTime = osl_getGlobalTimer(); }
-
 void ProfileZone::stopConsole()
 {
     sal_uInt32 nEndTime = osl_getGlobalTimer();
diff --git a/include/comphelper/profilezone.hxx b/include/comphelper/profilezone.hxx
index 7525b6322152..b401ddbdc6be 100644
--- a/include/comphelper/profilezone.hxx
+++ b/include/comphelper/profilezone.hxx
@@ -23,7 +23,6 @@ class COMPHELPER_DLLPUBLIC ProfileZone : public TraceEvent
     const char *m_sProfileId;
     long long m_nCreateTime;
     bool m_bConsole;
-    void startConsole();
     void stopConsole();
     int m_nPid;
 
@@ -50,12 +49,17 @@ class COMPHELPER_DLLPUBLIC ProfileZone : public TraceEvent
         : m_sProfileId(sProfileId ? sProfileId : "(null)")
         , m_bConsole(bConsole)
     {
-        if (s_bRecording)
+        if (s_bRecording || m_bConsole)
         {
             TimeValue systemTime;
             osl_getSystemTime( &systemTime );
             m_nCreateTime = static_cast<long long>(systemTime.Seconds) * 1000000 + systemTime.Nanosec/1000;
+        }
+        else
+            m_nCreateTime = 0;
 
+        if (s_bRecording)
+        {
             oslProcessInfo aProcessInfo;
             aProcessInfo.Size = sizeof(oslProcessInfo);
             if (osl_getProcessInfo(nullptr, osl_Process_IDENTIFIER, &aProcessInfo) == osl_Process_E_None)
@@ -63,12 +67,6 @@ class COMPHELPER_DLLPUBLIC ProfileZone : public TraceEvent
 
             s_nNesting++;
         }
-        else
-            m_nCreateTime = 0;
-        if (m_bConsole)
-        {
-            startConsole();
-        }
     }
 
     ~ProfileZone()


More information about the Libreoffice-commits mailing list