summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2021-04-27 10:48:09 +0300
committerTor Lillqvist <tml@collabora.com>2021-04-29 14:12:15 +0200
commitd3805da9617c07c368088ba50329b19da1895193 (patch)
tree1ddaf5f5c305af1acd05b413f190b7f4040941f8
parent9302478952df0bc5456c9e36b5659626d1da31b3 (diff)
Move some static functions from ProfileZone to TraceEvent where they belong
Change-Id: I35f3d5d8c0a69a224cf7d3a2decba9c8e13c7dc1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114780 Tested-by: Tor Lillqvist <tml@collabora.com> Reviewed-by: Tor Lillqvist <tml@collabora.com>
-rw-r--r--comphelper/source/misc/traceevent.cxx35
-rw-r--r--desktop/source/lib/init.cxx8
-rw-r--r--include/comphelper/profilezone.hxx5
-rw-r--r--include/comphelper/traceevent.hxx5
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx4
5 files changed, 29 insertions, 28 deletions
diff --git a/comphelper/source/misc/traceevent.cxx b/comphelper/source/misc/traceevent.cxx
index b1313271f89b..59191884374c 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,21 +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);
-}
} // namespace comphelper
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index b646356a9365..f46530ebc803 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3868,9 +3868,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)
{
@@ -6129,7 +6129,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)
{
@@ -6209,7 +6209,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 22fe107a3bf1..cb5e32547d7c 100644
--- a/include/comphelper/profilezone.hxx
+++ b/include/comphelper/profilezone.hxx
@@ -63,11 +63,6 @@ class COMPHELPER_DLLPUBLIC ProfileZone : public TraceEvent
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 129cf5ee7300..e79ceefbacbf 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::ProfileZone::startRecording();
+ comphelper::TraceEvent::startRecording();
}
void SAL_CALL VCLXToolkit::stopRecording()
{
- comphelper::ProfileZone::stopRecording();
+ comphelper::TraceEvent::stopRecording();
}
css::uno::Sequence< OUString > VCLXToolkit::getRecordingAndClear()