[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - desktop/source
Tor Lillqvist (via logerrit)
logerrit at kemper.freedesktop.org
Mon May 10 16:04:06 UTC 2021
desktop/source/lib/init.cxx | 62 +++++++++++++++++++++++++-------------------
1 file changed, 36 insertions(+), 26 deletions(-)
New commits:
commit 796e85624b783830dcd1809cf5e1897aaafe2e7e
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Mon May 10 15:50:45 2021 +0300
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Mon May 10 18:03:30 2021 +0200
We must collect the Trace Events when recording them is turned on
Recording them can be turned on and off on-the-fly.
Also rename the class from ProfileZoneDumper to TraceEventDumper as
ProfileZones are just one special case of Trace Events.
Change-Id: I4928397937963c83ffe8022ba4fa941f81119e15
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115332
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Tor Lillqvist <tml at collabora.com>
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index fecf7871f69b..3e6231157cfa 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -207,6 +207,37 @@ struct ExtensionMap
const char *filterName;
};
+class TraceEventDumper : public AutoTimer
+{
+ static const int dumpTimeoutMS = 5000;
+
+public:
+ TraceEventDumper() : AutoTimer( "Trace Event dumper" )
+ {
+ SetTimeout(dumpTimeoutMS);
+ Start();
+ }
+ virtual void Invoke() override
+ {
+ const css::uno::Sequence<OUString> aEvents =
+ comphelper::TraceEvent::getRecordingAndClear();
+ OStringBuffer aOutput;
+ for (const auto &s : aEvents)
+ {
+ aOutput.append(OUStringToOString(s, RTL_TEXTENCODING_UTF8));
+ aOutput.append("\n");
+ }
+ if (aOutput.getLength() > 0)
+ {
+ OString aChunk = aOutput.makeStringAndClear();
+ if (gImpl && gImpl->mpCallback)
+ gImpl->mpCallback(LOK_CALLBACK_PROFILE_FRAME, aChunk.getStr(), gImpl->mpCallbackData);
+ }
+ }
+};
+
+static TraceEventDumper *traceEventDumper = nullptr;
+
static const ExtensionMap aWriterExtensionMap[] =
{
{ "doc", "MS Word 97" },
@@ -3868,7 +3899,11 @@ static void lo_setOption(LibreOfficeKit* /*pThis*/, const char *pOption, const c
if (strcmp(pOption, "traceeventrecording") == 0)
{
if (strcmp(pValue, "start") == 0)
+ {
comphelper::TraceEvent::startRecording();
+ if (traceEventDumper == nullptr)
+ traceEventDumper = new TraceEventDumper();
+ }
else if (strcmp(pValue, "stop") == 0)
comphelper::TraceEvent::stopRecording();
}
@@ -6117,31 +6152,6 @@ static void preloadData()
rtl::Bootstrap::set("UserInstallation", sUserPath);
}
-class ProfileZoneDumper : public AutoTimer
-{
- static const int dumpTimeoutMS = 5000;
-public:
- ProfileZoneDumper() : AutoTimer( "zone dumper" )
- {
- SetTimeout(dumpTimeoutMS);
- Start();
- }
- virtual void Invoke() override
- {
- const css::uno::Sequence<OUString> aEvents =
- comphelper::TraceEvent::getRecordingAndClear();
- OStringBuffer aOutput;
- for (const auto &s : aEvents)
- {
- aOutput.append(OUStringToOString(s, RTL_TEXTENCODING_UTF8));
- aOutput.append("\n");
- }
- OString aChunk = aOutput.makeStringAndClear();
- if (gImpl && gImpl->mpCallback)
- gImpl->mpCallback(LOK_CALLBACK_PROFILE_FRAME, aChunk.getStr(), gImpl->mpCallbackData);
- }
-};
-
static void activateNotebookbar(const OUString& rApp)
{
OUString aPath = "org.openoffice.Office.UI.ToolbarMode/Applications/" + rApp;
@@ -6210,7 +6220,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
if (bProfileZones && eStage == SECOND_INIT)
{
comphelper::TraceEvent::startRecording();
- new ProfileZoneDumper();
+ traceEventDumper = new TraceEventDumper();
}
comphelper::ProfileZone aZone("lok-init");
More information about the Libreoffice-commits
mailing list