comphelper/source/misc/traceevent.cxx | 36 +++++++++++++++++----------------- desktop/source/lib/init.cxx | 8 +++---- include/comphelper/profilezone.hxx | 5 ---- include/comphelper/traceevent.hxx | 5 ++++ toolkit/source/awt/vclxtoolkit.cxx | 4 +-- 5 files changed, 29 insertions(+), 29 deletions(-)
New commits: commit 843db78050bb44db2839c1bd7f765a5b258ba4da Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Tue Apr 27 10:48:09 2021 +0300 Commit: Tor Lillqvist <t...@collabora.com> CommitDate: Wed Apr 28 13:44:15 2021 +0200 Move some static functions from ProfileZone to TraceEvent where they belong Change-Id: I35f3d5d8c0a69a224cf7d3a2decba9c8e13c7dc1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114698 Tested-by: Tor Lillqvist <t...@collabora.com> Reviewed-by: Tor Lillqvist <t...@collabora.com> diff --git a/comphelper/source/misc/traceevent.cxx b/comphelper/source/misc/traceevent.cxx index aa99e8bf7e39..6e86c3f03993 100644 --- a/comphelper/source/misc/traceevent.cxx +++ b/comphelper/source/misc/traceevent.cxx @@ -67,14 +67,30 @@ void TraceEvent::addInstantEvent(const char* sProfileId) + OUString::number(osl_getThreadIdentifier(nullptr)) + "},"); } -void ProfileZone::startRecording() +void TraceEvent::startRecording() { ::osl::MutexGuard aGuard(g_aMutex); s_nNesting = 0; s_bRecording = true; } -void ProfileZone::stopRecording() { s_bRecording = false; } +void TraceEvent::stopRecording() { s_bRecording = false; } + +css::uno::Sequence<OUString> TraceEvent::getRecordingAndClear() +{ + bool bRecording; + std::vector<OUString> aRecording; + { + ::osl::MutexGuard aGuard(g_aMutex); + bRecording = s_bRecording; + stopRecording(); + aRecording.swap(g_aRecording); + } + // reset start time and nesting level + if (bRecording) + startRecording(); + return ::comphelper::containerToSequence(aRecording); +} void ProfileZone::addRecording() { @@ -104,22 +120,6 @@ void ProfileZone::addRecording() + OUString::number(osl_getThreadIdentifier(nullptr)) + "},"); } -css::uno::Sequence<OUString> ProfileZone::getRecordingAndClear() -{ - bool bRecording; - std::vector<OUString> aRecording; - { - ::osl::MutexGuard aGuard(g_aMutex); - bRecording = s_bRecording; - stopRecording(); - aRecording.swap(g_aRecording); - } - // reset start time and nesting level - if (bRecording) - startRecording(); - return ::comphelper::containerToSequence(aRecording); -} - void ProfileZone::startConsole() { m_nCreateTime = osl_getGlobalTimer(); } void ProfileZone::stopConsole() diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index ecbd0f3f97e5..6ebe3a1ce686 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3852,9 +3852,9 @@ static void lo_setOption(LibreOfficeKit* /*pThis*/, const char *pOption, const c if (strcmp(pOption, "profilezonerecording") == 0) { if (strcmp(pValue, "start") == 0) - comphelper::ProfileZone::startRecording(); + comphelper::TraceEvent::startRecording(); else if (strcmp(pValue, "stop") == 0) - comphelper::ProfileZone::stopRecording(); + comphelper::TraceEvent::stopRecording(); } else if (strcmp(pOption, "sallogoverride") == 0) { @@ -6107,7 +6107,7 @@ public: virtual void Invoke() override { const css::uno::Sequence<OUString> aEvents = - comphelper::ProfileZone::getRecordingAndClear(); + comphelper::TraceEvent::getRecordingAndClear(); OStringBuffer aOutput; for (const auto &s : aEvents) { @@ -6189,7 +6189,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char // Turn profile zones on early if (bProfileZones && eStage == SECOND_INIT) { - comphelper::ProfileZone::startRecording(); + comphelper::TraceEvent::startRecording(); new ProfileZoneDumper(); } diff --git a/include/comphelper/profilezone.hxx b/include/comphelper/profilezone.hxx index 474b296f184c..4bdd6ad53fb5 100644 --- a/include/comphelper/profilezone.hxx +++ b/include/comphelper/profilezone.hxx @@ -87,11 +87,6 @@ public: ProfileZone(const ProfileZone&) = delete; void operator=(const ProfileZone&) = delete; - - static void startRecording(); - static void stopRecording(); - - static css::uno::Sequence<OUString> getRecordingAndClear(); }; } // namespace comphelper diff --git a/include/comphelper/traceevent.hxx b/include/comphelper/traceevent.hxx index 5c922b281487..14e25da9b791 100644 --- a/include/comphelper/traceevent.hxx +++ b/include/comphelper/traceevent.hxx @@ -34,6 +34,11 @@ protected: public: static void addInstantEvent(const char* sProfileId); + + static void startRecording(); + static void stopRecording(); + + static css::uno::Sequence<OUString> getRecordingAndClear(); }; } // namespace comphelper diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index 7d99f52287ab..10eb7f8019e2 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -2562,12 +2562,12 @@ void SAL_CALL VCLXToolkit::pause(sal_Int32 nMilliseconds) void SAL_CALL VCLXToolkit::startRecording() { - comphelper::ProfileZone::startRecording(); + comphelper::TraceEvent::startRecording(); } void SAL_CALL VCLXToolkit::stopRecording() { - comphelper::ProfileZone::stopRecording(); + comphelper::TraceEvent::stopRecording(); } css::uno::Sequence< OUString > VCLXToolkit::getRecordingAndClear() _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits