comphelper/source/misc/profilezone.cxx | 27 +++++++++++++++------------ desktop/source/lib/init.cxx | 2 +- include/comphelper/profilezone.hxx | 3 ++- toolkit/source/awt/vclxtoolkit.cxx | 4 ++-- 4 files changed, 20 insertions(+), 16 deletions(-)
New commits: commit dd57e1e9de21f05ff2c9c477c1a17ac25cd5bdfe Author: Tor Lillqvist <[email protected]> AuthorDate: Wed Apr 14 12:47:14 2021 +0300 Commit: Tor Lillqvist <[email protected]> CommitDate: Wed Apr 14 15:48:05 2021 +0200 Clarify the ProfileRecording API Instead of a startRecording(bool) function that is used to also stop recording, have separate startRecording() and stopRecording() functions that do what they say. Change-Id: Ifa9ea0e530d5d38baa52f685fc1dc0029d30d023 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114081 Tested-by: Tor Lillqvist <[email protected]> Reviewed-by: Tor Lillqvist <[email protected]> diff --git a/comphelper/source/misc/profilezone.cxx b/comphelper/source/misc/profilezone.cxx index ff76a4f35e8d..4d6d94744c88 100644 --- a/comphelper/source/misc/profilezone.cxx +++ b/comphelper/source/misc/profilezone.cxx @@ -30,17 +30,19 @@ static int g_aNesting; // level of overlapped zones static long long g_aStartTime; // start time of recording static ::osl::Mutex g_aMutex; -void startRecording(bool bStartRecording) +void startRecording() { - if (bStartRecording) - { - TimeValue systemTime; - osl_getSystemTime( &systemTime ); - ::osl::MutexGuard aGuard( g_aMutex ); - g_aStartTime = static_cast<long long>(systemTime.Seconds) * 1000000 + systemTime.Nanosec/1000; - g_aNesting = 0; - } - ProfileZone::g_bRecording = bStartRecording; + TimeValue systemTime; + osl_getSystemTime( &systemTime ); + ::osl::MutexGuard aGuard( g_aMutex ); + g_aStartTime = static_cast<long long>(systemTime.Seconds) * 1000000 + systemTime.Nanosec/1000; + g_aNesting = 0; + ProfileZone::g_bRecording = true; +} + +void stopRecording() +{ + ProfileZone::g_bRecording = false; } long long addRecording(const char * aProfileId, long long aCreateTime) @@ -86,13 +88,14 @@ css::uno::Sequence<OUString> getRecordingAndClear() { ::osl::MutexGuard aGuard( g_aMutex ); bRecording = ProfileZone::g_bRecording; - startRecording(false); + stopRecording(); aRecording.swap(g_aRecording); long long aSumTime = g_aSumTime; aRecording.insert(aRecording.begin(), OUString::number(aSumTime/1000000.0)); } // reset start time and nesting level - startRecording(bRecording); + if (bRecording) + startRecording(); return ::comphelper::containerToSequence(aRecording); } diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 8d641cd1383f..c175b2fa02ad 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -6179,7 +6179,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char // Turn profile zones on early if (bProfileZones && eStage == SECOND_INIT) { - comphelper::ProfileRecording::startRecording(true); + comphelper::ProfileRecording::startRecording(); new ProfileZoneDumper(); } diff --git a/include/comphelper/profilezone.hxx b/include/comphelper/profilezone.hxx index 8cbc078f6621..b54d69523fd6 100644 --- a/include/comphelper/profilezone.hxx +++ b/include/comphelper/profilezone.hxx @@ -26,7 +26,8 @@ namespace comphelper namespace ProfileRecording { -COMPHELPER_DLLPUBLIC void startRecording(bool bRecording); +COMPHELPER_DLLPUBLIC void startRecording(); +COMPHELPER_DLLPUBLIC void stopRecording(); COMPHELPER_DLLPUBLIC long long addRecording(const char * aProfileId, long long aCreateTime); diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index 2121e14c3e15..95e731beb2df 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -2535,12 +2535,12 @@ void SAL_CALL VCLXToolkit::pause(sal_Int32 nMilliseconds) void SAL_CALL VCLXToolkit::startRecording() { - ::comphelper::ProfileRecording::startRecording(true); + ::comphelper::ProfileRecording::startRecording(); } void SAL_CALL VCLXToolkit::stopRecording() { - ::comphelper::ProfileRecording::startRecording( false ); + ::comphelper::ProfileRecording::stopRecording(); } css::uno::Sequence< OUString > VCLXToolkit::getRecordingAndClear() _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
