[Libreoffice-commits] online.git: wsd/DocumentBroker.cpp wsd/DocumentBroker.hpp
Michael Meeks
michael.meeks at collabora.com
Sat Mar 11 22:01:59 UTC 2017
wsd/DocumentBroker.cpp | 15 ++++++++++++++-
wsd/DocumentBroker.hpp | 4 +++-
2 files changed, 17 insertions(+), 2 deletions(-)
New commits:
commit 51ae42d513842994091d10b15565ba4741092122
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Sat Mar 11 22:01:27 2017 +0000
DocumentBroker: log load time and dump it on request.
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 6ddb463..c4c3307 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -190,6 +190,8 @@ void DocumentBroker::pollThread()
LOG_INF("Starting docBroker polling thread for docKey [" << _docKey << "].");
+ _threadStart = std::chrono::steady_clock::now();
+
// Request a kit process for this doc.
_childProcess = getNewChild_Blocks();
if (!_childProcess)
@@ -603,6 +605,14 @@ bool DocumentBroker::saveToStorageInternal(const std::string& sessionId,
return false;
}
+void DocumentBroker::setLoaded()
+{
+ _isLoaded = true;
+ _loadDuration = std::chrono::duration_cast<std::chrono::milliseconds>(
+ std::chrono::steady_clock::now() - _threadStart);
+ LOG_TRC("Document loaded in " << _loadDuration.count() << "ms");
+}
+
bool DocumentBroker::autoSave(const bool force)
{
if (_sessions.empty() || _storage == nullptr || !_isLoaded ||
@@ -1311,7 +1321,10 @@ void DocumentBroker::dumpState()
std::cerr << " *** Marked to destroy ***\n";
else
std::cerr << " has live sessions\n";
- std::cerr << " loaded?: " << _isLoaded << "\n";
+ if (_isLoaded)
+ std::cerr << " loaded in: " << _loadDuration.count() << "ms\n";
+ else
+ std::cerr << " still loading...\n";
std::cerr << " modified?: " << _isModified << "\n";
std::cerr << " jail id: " << _jailId << "\n";
std::cerr << " public uri: " << _uriPublic.toString() << "\n";
diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index b07b9b5..0ca4ab7 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -234,7 +234,7 @@ public:
/// Loads a document from the public URI into the jail.
bool load(std::shared_ptr<ClientSession>& session, const std::string& jailId);
bool isLoaded() const { return _isLoaded; }
- void setLoaded() { _isLoaded = true; }
+ void setLoaded();
/// Save the document to Storage if it needs persisting.
bool saveToStorage(const std::string& sesionId, bool success, const std::string& result = "");
@@ -417,6 +417,8 @@ private:
int _debugRenderedTileCount;
std::chrono::steady_clock::time_point _lastActivityTime;
+ std::chrono::steady_clock::time_point _threadStart;
+ std::chrono::milliseconds _loadDuration;
static constexpr auto IdleSaveDurationMs = 30 * 1000;
static constexpr auto AutoSaveDurationMs = 300 * 1000;
More information about the Libreoffice-commits
mailing list