[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - desktop/source include/LibreOfficeKit libreofficekit/source
Michael Meeks (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jul 31 13:12:19 UTC 2019
desktop/source/lib/init.cxx | 36 +++++++++++++++++++++++++++
include/LibreOfficeKit/LibreOfficeKitEnums.h | 6 ++++
libreofficekit/source/gtk/lokdocview.cxx | 2 +
3 files changed, 44 insertions(+)
New commits:
commit 9fd9e61c8211b76996116389631ead52a58c3d0e
Author: Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Fri Apr 12 21:16:38 2019 +0100
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Wed Jul 31 15:11:42 2019 +0200
lok: emit ProfileZone data in messages when requested.
Change-Id: I42a773e2d5b8e4deeafa8eeb2785913db36a47d7
Reviewed-on: https://gerrit.libreoffice.org/70688
Tested-by: Jenkins
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/76748
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 cdf3c01a2c41..7dd7fe6644e1 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -45,6 +45,7 @@
#include <comphelper/lok.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
+#include <comphelper/profilezone.hxx>
#include <comphelper/propertysequence.hxx>
#include <comphelper/scopeguard.hxx>
#include <comphelper/threadpool.hxx>
@@ -4124,6 +4125,31 @@ static void preloadData()
}
}
+class ProfileZoneDumper : public AutoTimer
+{
+ static const int dumpTimeoutMS = 5000;
+public:
+ ProfileZoneDumper() : AutoTimer( "zone dumper" )
+ {
+ SetTimeout(dumpTimeoutMS);
+ Start();
+ }
+ virtual void Invoke() override
+ {
+ css::uno::Sequence<OUString> aEvents =
+ comphelper::ProfileRecording::getRecordingAndClear();
+ OStringBuffer aOutput;
+ for (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 int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char* pUserProfileUrl)
{
enum {
@@ -4134,6 +4160,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
// Did we do a pre-initialize
static bool bPreInited = false;
+ static bool bProfileZones = getenv("SAL_PROFILEZONE_STDOUT") != nullptr;
// What stage are we at ?
if (pThis == nullptr)
@@ -4148,6 +4175,15 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
if (bInitialized)
return 1;
+ // Turn profile zones on early
+ if (bProfileZones && eStage == SECOND_INIT)
+ {
+ comphelper::ProfileRecording::startRecording(true);
+ new ProfileZoneDumper();
+ }
+
+ comphelper::ProfileZone aZone("lok-init");
+
if (eStage == PRE_INIT)
rtl_alloc_preInit(true);
else if (eStage == SECOND_INIT)
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index cb9091711acc..f5549ec3cd42 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -608,6 +608,12 @@ typedef enum
* On-load notification of the document signature status.
*/
LOK_CALLBACK_SIGNATURE_STATUS = 40,
+
+ /**
+ * Profiling tracing information single string of multiple lines
+ * containing <pid> <timestamp> and zone start/stop information
+ */
+ LOK_CALLBACK_PROFILE_FRAME = 41
}
LibreOfficeKitCallbackType;
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 7d288a449651..d3363c3c8976 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -448,6 +448,8 @@ callbackTypeToString (int nType)
return "LOK_CALLBACK_CONTEXT_CHANGED";
case LOK_CALLBACK_SIGNATURE_STATUS:
return "LOK_CALLBACK_SIGNATURE_STATUS";
+ case LOK_CALLBACK_PROFILE_FRAME:
+ return "LOK_CALLBACK_PROFILE_FRAME";
}
g_assert(false);
return nullptr;
More information about the Libreoffice-commits
mailing list