diff options
author | Tor Lillqvist <tml@collabora.com> | 2021-04-14 12:47:14 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2021-04-14 15:48:05 +0200 |
commit | dd57e1e9de21f05ff2c9c477c1a17ac25cd5bdfe (patch) | |
tree | 047f95aea12629e34ac1263cccb141bb626bdde6 /comphelper | |
parent | 5f18922496ec60255097048d9b00b70fc6ccbba5 (diff) |
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 <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/misc/profilezone.cxx | 27 |
1 files changed, 15 insertions, 12 deletions
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); } |