[Libreoffice-commits] online.git: common/Session.hpp wsd/ClientSession.cpp wsd/ClientSession.hpp
Michael Meeks
michael.meeks at collabora.com
Mon Sep 11 18:00:57 UTC 2017
common/Session.hpp | 1 +
wsd/ClientSession.cpp | 21 +++++++++++++++++----
wsd/ClientSession.hpp | 3 +++
3 files changed, 21 insertions(+), 4 deletions(-)
New commits:
commit 5c879a17b22b60ede615d3e32d74f01af7c4b7f5
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Mon Sep 11 18:59:38 2017 +0100
Count key-strokes, and report per session.
Change-Id: Id661fc15d4a75e322024ce62d24b2d7dae8f256a
diff --git a/common/Session.hpp b/common/Session.hpp
index 99961848..645ec3c5 100644
--- a/common/Session.hpp
+++ b/common/Session.hpp
@@ -119,6 +119,7 @@ private:
/// True if the user is active, otherwise false (switched tabs).
std::atomic<bool> _isActive;
+ /// Time of the last interactive event being received
std::chrono::steady_clock::time_point _lastActivityTime;
// Whether websocket received close frame. Closing Handshake
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index 2e455029..c96a8542 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -40,7 +40,8 @@ ClientSession::ClientSession(const std::string& id,
_uriPublic(uriPublic),
_isDocumentOwner(false),
_isAttached(false),
- _isViewLoaded(false)
+ _isViewLoaded(false),
+ _keyEvents(1)
{
const size_t curConnections = ++LOOLWSD::NumConnections;
LOG_INF("ClientSession ctor [" << getName() << "], current number of connections: " << curConnections);
@@ -82,7 +83,6 @@ bool ClientSession::_handleInput(const char *buffer, int length)
updateLastActivityTime();
docBroker->updateLastActivityTime();
}
-
if (tokens[0] == "loolclient")
{
const auto versionTuple = ParseVersion(tokens[1]);
@@ -240,6 +240,9 @@ bool ClientSession::_handleInput(const char *buffer, int length)
}
else
{
+ if (tokens[0] == "key")
+ _keyEvents++;
+
if (!filterMessage(firstLine))
{
const std::string dummyFrame = "dummymsg";
@@ -879,9 +882,19 @@ void ClientSession::dumpState(std::ostream& os)
os << "\t\tisReadOnly: " << isReadOnly()
<< "\n\t\tisDocumentOwner: " << _isDocumentOwner
<< "\n\t\tisAttached: " << _isAttached
- << "\n";
+ << "\n\t\tkeyEvents: " << _keyEvents;
+
+ std::shared_ptr<StreamSocket> socket = _socket.lock();
+ if (socket)
+ {
+ uint64_t sent, recv;
+ socket->getIOStats(sent, recv);
+ os << "\n\t\tsent/keystroke: " << (double)sent/_keyEvents << "bytes";
+ }
+
+ os << "\n";
_senderQueue.dumpState(os);
-}
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/wsd/ClientSession.hpp b/wsd/ClientSession.hpp
index dd2ea0e3..abadb86d 100644
--- a/wsd/ClientSession.hpp
+++ b/wsd/ClientSession.hpp
@@ -162,6 +162,9 @@ private:
/// Wopi FileInfo object
std::unique_ptr<WopiStorage::WOPIFileInfo> _wopiFileInfo;
+ /// Count of key-strokes
+ uint64_t _keyEvents;
+
SenderQueue<std::shared_ptr<Message>> _senderQueue;
};
More information about the Libreoffice-commits
mailing list