include/comphelper/profilezone.hxx | 39 ++++++++++++++++++++++--------------- include/comphelper/traceevent.hxx | 20 ++++++++++++++---- 2 files changed, 39 insertions(+), 20 deletions(-)
New commits: commit 0fa2bb31b53c2b9114480ab77e0db4e011691440 Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Mon May 31 15:55:20 2021 +0300 Commit: Tor Lillqvist <t...@collabora.com> CommitDate: Wed Jun 9 16:52:15 2021 +0200 Avoid empty std::map constructor Change-Id: Ie1bc333409fb201d82dd2cff7597e281600f01db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116449 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Tor Lillqvist <t...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116849 Tested-by: Jenkins diff --git a/include/comphelper/profilezone.hxx b/include/comphelper/profilezone.hxx index babd11f5b93b..08e6a8b031e8 100644 --- a/include/comphelper/profilezone.hxx +++ b/include/comphelper/profilezone.hxx @@ -31,6 +31,24 @@ class COMPHELPER_DLLPUBLIC ProfileZone : public NamedEvent void addRecording(); + ProfileZone(const char* sName, const OUString& sArgs, bool bConsole) + : NamedEvent(sName, sArgs) + , m_bConsole(bConsole) + , m_nNesting(-1) + { + if (s_bRecording || m_bConsole) + { + TimeValue systemTime; + osl_getSystemTime(&systemTime); + m_nCreateTime + = static_cast<long long>(systemTime.Seconds) * 1000000 + systemTime.Nanosec / 1000; + + m_nNesting = s_nNesting++; + } + else + m_nCreateTime = 0; + } + public: /** * Starts measuring the cost of a C++ scope. @@ -47,23 +65,14 @@ public: * Similar to the DEBUG macro in sal/log.hxx, don't forget to remove these lines before * committing. */ - ProfileZone(const char* sName, bool bConsole = false, - const std::map<OUString, OUString>& args = std::map<OUString, OUString>()) - : NamedEvent(sName, args) - , m_bConsole(bConsole) - , m_nNesting(-1) + ProfileZone(const char* sName, const std::map<OUString, OUString>& aArgs, bool bConsole = false) + : ProfileZone(sName, createArgsString(aArgs), bConsole) { - if (s_bRecording || m_bConsole) - { - TimeValue systemTime; - osl_getSystemTime(&systemTime); - m_nCreateTime - = static_cast<long long>(systemTime.Seconds) * 1000000 + systemTime.Nanosec / 1000; + } - m_nNesting = s_nNesting++; - } - else - m_nCreateTime = 0; + ProfileZone(const char* sName, bool bConsole = false) + : ProfileZone(sName, OUString(), bConsole) + { } ~ProfileZone() diff --git a/include/comphelper/traceevent.hxx b/include/comphelper/traceevent.hxx index 6e614ec0552e..5e2502de72a1 100644 --- a/include/comphelper/traceevent.hxx +++ b/include/comphelper/traceevent.hxx @@ -82,9 +82,14 @@ protected: const int m_nPid; const OUString m_sArgs; - TraceEvent(std::map<OUString, OUString> args) + TraceEvent(const OUString& sArgs) : m_nPid(getPid()) - , m_sArgs(createArgsString(args)) + , m_sArgs(sArgs) + { + } + + TraceEvent(std::map<OUString, OUString> aArgs) + : TraceEvent(createArgsString(aArgs)) { } @@ -105,9 +110,14 @@ class COMPHELPER_DLLPUBLIC NamedEvent : public TraceEvent protected: const char* m_sName; - NamedEvent(const char* sName, - const std::map<OUString, OUString>& args = std::map<OUString, OUString>()) - : TraceEvent(args) + NamedEvent(const char* sName, const OUString& sArgs) + : TraceEvent(sArgs) + , m_sName(sName ? sName : "(null)") + { + } + + NamedEvent(const char* sName, const std::map<OUString, OUString>& aArgs) + : TraceEvent(aArgs) , m_sName(sName ? sName : "(null)") { } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits