diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2019-04-12 21:16:38 +0100 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2019-04-24 22:21:37 +0200 |
commit | c96b9c9fbed5d8b82dc90f6330256c1991b289cc (patch) | |
tree | da5679c99d2517658d5a9750ca46aaeca2a559b4 /desktop | |
parent | mysqlc: Allow conversions between different types (diff) | |
download | core-c96b9c9fbed5d8b82dc90f6330256c1991b289cc.tar.gz core-c96b9c9fbed5d8b82dc90f6330256c1991b289cc.zip |
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@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/70766
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/lib/init.cxx | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 5010fe406c1e..a3577809aa45 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -46,6 +46,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> @@ -4567,6 +4568,31 @@ 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 + { + 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 { @@ -4577,6 +4603,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) @@ -4591,6 +4618,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(rtlAllocPreInitStart); else if (eStage == SECOND_INIT) |