[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4-0' - wsd/AdminModel.hpp wsd/DocumentBroker.cpp
Michael Meeks (via logerrit)
logerrit at kemper.freedesktop.org
Wed May 6 05:58:11 UTC 2020
wsd/AdminModel.hpp | 4 ++--
wsd/DocumentBroker.cpp | 24 +++++++++++++++++-------
2 files changed, 19 insertions(+), 9 deletions(-)
New commits:
commit ff826e6f1efc9cdd14990f5bea1de30f86ec2d73
Author: Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Mon May 4 15:18:51 2020 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Wed May 6 07:57:53 2020 +0200
admin: cleanup sent/recv accounting - and initialize the totals.
Change-Id: I96265c5d0e7b18d9ae19efa0ce7477aead75dbf7
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93422
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Gabriel Masei <gabriel.masei at 1and1.ro>
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93439
Reviewed-by: Andras Timar <andras.timar at collabora.com>
diff --git a/wsd/AdminModel.hpp b/wsd/AdminModel.hpp
index 4c22182ba..bf1e76128 100644
--- a/wsd/AdminModel.hpp
+++ b/wsd/AdminModel.hpp
@@ -303,8 +303,8 @@ private:
std::list<unsigned> _recvStats;
unsigned _recvStatsSize = 100;
- uint64_t _sentBytesTotal;
- uint64_t _recvBytesTotal;
+ uint64_t _sentBytesTotal = 0;
+ uint64_t _recvBytesTotal = 0;
/// We check the owner even in the release builds, needs to be always correct.
std::thread::id _owner;
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 75d9387ed..ae7d2ecf5 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -300,14 +300,24 @@ void DocumentBroker::pollThread()
lastBWUpdateTime = now;
uint64_t sent, recv;
getIOStats(sent, recv);
+
+ uint64_t deltaSent = 0, deltaRecv = 0;
+
+ // connection drop transiently reduces this.
+ if (sent > adminSent)
+ {
+ deltaSent = sent - adminSent;
+ adminSent = sent;
+ }
+ if (recv > deltaRecv)
+ {
+ deltaRecv = recv - adminRecv;
+ adminRecv = recv;
+ }
+ LOG_TRC("Doc [" << _docKey << "] added stats sent: +" << deltaSent << ", recv: +" << deltaRecv << " bytes to totals.");
+
// send change since last notification.
- Admin::instance().addBytes(getDocKey(),
- // connection drop transiently reduces this.
- (sent > adminSent ? (sent - adminSent): uint64_t(0)),
- (recv > adminRecv ? (recv - adminRecv): uint64_t(0)));
- adminSent = sent;
- adminRecv = recv;
- LOG_TRC("Doc [" << _docKey << "] added stats sent: " << sent << ", recv: " << recv << " bytes to totals.");
+ Admin::instance().addBytes(getDocKey(), deltaSent, deltaRecv);
}
#endif
More information about the Libreoffice-commits
mailing list