[Libreoffice-commits] online.git: Branch 'private/mmeeks/uds' - 9 commits - common/Log.cpp common/Log.hpp common/Png.hpp common/Util.cpp kit/Kit.cpp loleaflet/src net/Socket.cpp wsd/DocumentBroker.cpp wsd/TileCache.cpp wsd/TileDesc.hpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Apr 27 15:42:18 UTC 2019


 common/Log.cpp                        |   15 ++++++++++
 common/Log.hpp                        |   26 +++++++++--------
 common/Png.hpp                        |   10 ++++++
 common/Util.cpp                       |    4 +-
 kit/Kit.cpp                           |   24 ++++++++--------
 loleaflet/src/core/Socket.js          |   30 ++++++++++----------
 loleaflet/src/layer/tile/TileLayer.js |   11 ++++---
 net/Socket.cpp                        |    1 
 wsd/DocumentBroker.cpp                |   24 +++++++---------
 wsd/TileCache.cpp                     |    2 -
 wsd/TileDesc.hpp                      |   50 +++++++++++++++++++---------------
 11 files changed, 116 insertions(+), 81 deletions(-)

New commits:
commit 9d2d523f8938f504174ee33c5a13e7c52a6209dc
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Mon Apr 22 12:03:49 2019 -0400
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Sat Apr 27 16:29:45 2019 +0100

    wsd: reduce tile logging from debug to trace level
    
    These are very frequent and not very useful without
    the ability to trace them across the system, which
    are all done at trace level. So it's highly unlikely
    that these would be used at debug.
    
    Change-Id: I479f2ead1bbd2996b9972082e00ebf984072f785
    Reviewed-on: https://gerrit.libreoffice.org/71073
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 16db919a8..5d75f2637 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -1417,7 +1417,7 @@ void DocumentBroker::handleTileCombinedRequest(TileCombined& tileCombined,
 
         // Forward to child to render.
         const std::string req = newTileCombined.serialize("tilecombine");
-        LOG_DBG("Sending residual tilecombine: " << req);
+        LOG_TRC("Sending uncached residual tilecombine request to Kit: " << req);
         _childProcess->sendTextFrame(req);
     }
 
@@ -1566,7 +1566,7 @@ void DocumentBroker::sendRequestedTiles(const std::shared_ptr<ClientSession>& se
 
             // Forward to child to render.
             const std::string req = newTileCombined.serialize("tilecombine");
-            LOG_DBG("Some of the tiles were not prerendered. Sending residual tilecombine: " << req);
+            LOG_TRC("Some of the tiles were not prerendered. Sending residual tilecombine: " << req);
             _childProcess->sendTextFrame(req);
         }
     }
diff --git a/wsd/TileCache.cpp b/wsd/TileCache.cpp
index b46d16044..6a5a6e36f 100644
--- a/wsd/TileCache.cpp
+++ b/wsd/TileCache.cpp
@@ -371,7 +371,7 @@ void TileCache::invalidateTiles(int part, int x, int y, int width, int height)
             const std::string fileName = tileIterator.path().getFileName();
             if (intersectsTile(fileName, part, x, y, width, height))
             {
-                LOG_DBG("Removing tile: " << tileIterator.path().toString());
+                LOG_TRC("Removing tile: " << tileIterator.path().toString());
                 FileUtil::removeFile(tileIterator.path());
             }
         }
commit fee9341d078c21f49e55c855bebaf46400dea514
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Mon Apr 22 12:00:19 2019 -0400
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Sat Apr 27 15:44:01 2019 +0100

    leaflet: process the most common message first
    
    The 'tile:' message is the most common and most
    latency sensitive message, so give it priority.
    
    Change-Id: Id5790369cd493423a47acab8a3d5107ce91b0d39
    Reviewed-on: https://gerrit.libreoffice.org/71071
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>
    Signed-off-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index db0c1e6bf..a73c71e00 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -834,20 +834,22 @@ L.Socket = L.Class.extend({
 			this._map.fire('docloaded', {status: true});
 		}
 
-		// these can arrive very early during the startup
-		if (textMsg.startsWith('statusindicatorstart:')) {
-			this._map.fire('statusindicator', {statusType : 'start'});
-			return;
-		}
-		else if (textMsg.startsWith('statusindicatorsetvalue:')) {
-			var value = textMsg.match(/\d+/g)[0];
-			this._map.fire('statusindicator', {statusType : 'setvalue', value : value});
-			return;
-		}
-		else if (textMsg.startsWith('statusindicatorfinish:')) {
-			this._map.fire('statusindicator', {statusType : 'finish'});
-			this._map._fireInitComplete('statusindicatorfinish');
-			return;
+		// These can arrive very early during the startup, and never again.
+		if (textMsg.startsWith('statusindicator')) {
+			if (textMsg.startsWith('statusindicatorstart:')) {
+				this._map.fire('statusindicator', {statusType : 'start'});
+				return;
+			}
+			else if (textMsg.startsWith('statusindicatorsetvalue:')) {
+				var value = textMsg.match(/\d+/g)[0];
+				this._map.fire('statusindicator', {statusType : 'setvalue', value : value});
+				return;
+			}
+			else if (textMsg.startsWith('statusindicatorfinish:')) {
+				this._map.fire('statusindicator', {statusType : 'finish'});
+				this._map._fireInitComplete('statusindicatorfinish');
+				return;
+			}
 		}
 
 		if (this._map._docLayer) {
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index ca302390e..7a7bf8a6e 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -359,7 +359,11 @@ L.TileLayer = L.GridLayer.extend({
 	},
 
 	_onMessage: function (textMsg, img) {
-		if (textMsg.startsWith('commandvalues:')) {
+		// 'tile:' is the most common message type; keep this the first.
+		if (textMsg.startsWith('tile:')) {
+			this._onTileMsg(textMsg, img);
+		}
+		else if (textMsg.startsWith('commandvalues:')) {
 			this._onCommandValuesMsg(textMsg);
 		}
 		else if (textMsg.startsWith('cursorvisible:')) {
@@ -447,9 +451,6 @@ L.TileLayer = L.GridLayer.extend({
 		else if (textMsg.startsWith('textselectionstart:')) {
 			this._onTextSelectionStartMsg(textMsg);
 		}
-		else if (textMsg.startsWith('tile:')) {
-			this._onTileMsg(textMsg, img);
-		}
 		else if (textMsg.startsWith('windowpaint:')) {
 			this._onDialogPaintMsg(textMsg, img);
 		}
@@ -812,7 +813,7 @@ L.TileLayer = L.GridLayer.extend({
 		//first time document open, set last cursor position
 		if (this.lastCursorPos.lat === 0 && this.lastCursorPos.lng === 0)
 			this.lastCursorPos = cursorPos;
-		
+
 		var updateCursor = false;
 		if ((this.lastCursorPos.lat !== cursorPos.lat) || (this.lastCursorPos.lng !== cursorPos.lng)) {
 			updateCursor = true;
commit ac7db5b1c22259492004c0bd7b0d6a33938b4932
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Apr 20 14:58:48 2019 -0400
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Sat Apr 27 15:43:48 2019 +0100

    wsd: tile serializer now supports adding a suffix
    
    Moves appending tokens into the serializer and
    avoids making extra copies of itself.
    
    Change-Id: I62d374e69d9c4a55643ea20cb5f8c2b9c75c88c5
    Reviewed-on: https://gerrit.libreoffice.org/71022
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>
    Signed-off-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index 8b543204f..48bccf106 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -121,9 +121,9 @@ static std::string ObfuscatedFileId;
 #endif
 
 #if ENABLE_DEBUG
-#  define ADD_DEBUG_RENDERID(s) ((s)+ " renderid=" + Util::UniqueId())
+#  define ADD_DEBUG_RENDERID (" renderid=" + Util::UniqueId() + '\n')
 #else
-#  define ADD_DEBUG_RENDERID(s) (s)
+#  define ADD_DEBUG_RENDERID ("\n")
 #endif
 
 #ifndef MOBILEAPP
@@ -1098,9 +1098,9 @@ public:
 
         std::string tileMsg;
         if (combined)
-            tileMsg = ADD_DEBUG_RENDERID(tileCombined.serialize("tilecombine:")) + "\n";
+            tileMsg = tileCombined.serialize("tilecombine:", ADD_DEBUG_RENDERID);
         else
-            tileMsg = ADD_DEBUG_RENDERID(tiles[0].serialize("tile:")) + "\n";
+            tileMsg = tiles[0].serialize("tile:", ADD_DEBUG_RENDERID);
 
         LOG_TRC("Sending back painted tiles for " << tileMsg << " of size " << output.size() << " bytes) for: " << tileMsg);
 
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 3d87e7bb9..16db919a8 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -48,6 +48,12 @@ using namespace LOOLProtocol;
 
 using Poco::JSON::Object;
 
+#if ENABLE_DEBUG
+#  define ADD_DEBUG_RENDERID (" renderid=cached\n")
+#else
+#  define ADD_DEBUG_RENDERID ("\n")
+#endif
+
 void ChildProcess::setDocumentBroker(const std::shared_ptr<DocumentBroker>& docBroker)
 {
     assert(docBroker && "Invalid DocumentBroker instance.");
@@ -1340,11 +1346,7 @@ void DocumentBroker::handleTileRequest(TileDesc& tile,
     std::unique_ptr<std::fstream> cachedTile = _tileCache->lookupTile(tile);
     if (cachedTile)
     {
-#if ENABLE_DEBUG
-        const std::string response = tile.serialize("tile:") + " renderid=cached\n";
-#else
-        const std::string response = tile.serialize("tile:") + '\n';
-#endif
+        const std::string response = tile.serialize("tile:", ADD_DEBUG_RENDERID);
 
         std::vector<char> output;
         output.reserve(static_cast<size_t>(4) * tile.getWidth() * tile.getHeight());
@@ -1391,7 +1393,7 @@ void DocumentBroker::handleTileCombinedRequest(TileCombined& tileCombined,
 
     LOG_TRC("TileCombined request for " << tileCombined.serialize());
 
-    // Check which newly requested tiles needs rendering.
+    // Check which newly requested tiles need rendering.
     std::vector<TileDesc> tilesNeedsRendering;
     for (auto& tile : tileCombined.getTiles())
     {
@@ -1524,11 +1526,7 @@ void DocumentBroker::sendRequestedTiles(const std::shared_ptr<ClientSession>& se
             if (cachedTile)
             {
                 //TODO: Combine the response to reduce latency.
-#if ENABLE_DEBUG
-                const std::string response = tile.serialize("tile:") + " renderid=cached\n";
-#else
-                const std::string response = tile.serialize("tile:") + "\n";
-#endif
+                const std::string response = tile.serialize("tile:", ADD_DEBUG_RENDERID);
 
                 std::vector<char> output;
                 output.reserve(static_cast<size_t>(4) * tile.getWidth() * tile.getHeight());
diff --git a/wsd/TileDesc.hpp b/wsd/TileDesc.hpp
index e3c12938b..20f61d5c4 100644
--- a/wsd/TileDesc.hpp
+++ b/wsd/TileDesc.hpp
@@ -29,20 +29,21 @@ typedef uint64_t TileBinaryHash;
 class TileDesc
 {
 public:
-    TileDesc(int part, int width, int height, int tilePosX, int tilePosY, int tileWidth, int tileHeight, int ver, int imgSize, int id, bool broadcast) :
-        _part(part),
-        _width(width),
-        _height(height),
-        _tilePosX(tilePosX),
-        _tilePosY(tilePosY),
-        _tileWidth(tileWidth),
-        _tileHeight(tileHeight),
-        _ver(ver),
-        _imgSize(imgSize),
-        _id(id),
-        _broadcast(broadcast),
-        _oldWireId(0),
-        _wireId(0)
+    TileDesc(int part, int width, int height, int tilePosX, int tilePosY, int tileWidth,
+             int tileHeight, int ver, int imgSize, int id, bool broadcast)
+        : _part(part)
+        , _width(width)
+        , _height(height)
+        , _tilePosX(tilePosX)
+        , _tilePosY(tilePosY)
+        , _tileWidth(tileWidth)
+        , _tileHeight(tileHeight)
+        , _ver(ver)
+        , _imgSize(imgSize)
+        , _id(id)
+        , _broadcast(broadcast)
+        , _oldWireId(0)
+        , _wireId(0)
     {
         if (_part < 0 ||
             _width <= 0 ||
@@ -138,7 +139,8 @@ public:
 
     /// Serialize this instance into a string.
     /// Optionally prepend a prefix.
-    std::string serialize(const std::string& prefix = "") const
+    std::string serialize(const std::string& prefix = std::string(),
+                          const std::string& suffix = std::string()) const
     {
         std::ostringstream oss;
         oss << prefix
@@ -170,6 +172,7 @@ public:
             oss << " broadcast=yes";
         }
 
+        oss << suffix;
         return oss.str();
     }
 
@@ -343,7 +346,8 @@ public:
 
     /// Serialize this instance into a string.
     /// Optionally prepend a prefix.
-    std::string serialize(const std::string& prefix = "") const
+    std::string serialize(const std::string& prefix = std::string(),
+                          const std::string& suffix = std::string()) const
     {
         std::ostringstream oss;
         oss << prefix
@@ -389,15 +393,19 @@ public:
         oss.seekp(-1, std::ios_base::cur); // Ditto
 
         oss << " wid=";
+
+        bool comma = false;
         for (const auto& tile : _tiles)
         {
-            oss << tile.getWireId() << ',';
+            if (comma)
+                oss << ',';
+
+            oss << tile.getWireId();
+            comma = true;
         }
-        oss.seekp(-1, std::ios_base::cur); // See beow.
 
-        // Make sure we don't return a potential trailing comma that
-        // we have seeked back over but not overwritten after all.
-        return oss.str().substr(0, oss.tellp());
+        oss << suffix;
+        return oss.str();
     }
 
     /// Deserialize a TileDesc from a tokenized string.
commit 0d99dc7266ae105bc8665e121146439474b58c9a
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Apr 20 14:10:38 2019 -0400
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Sat Apr 27 15:43:44 2019 +0100

    wsd: set vector size when constructing
    
    Change-Id: I68718554017b47b6df1c6bf3b997483d4c753136
    Reviewed-on: https://gerrit.libreoffice.org/71021
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>
    Signed-off-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index 6b45c8534..8b543204f 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -29,8 +29,10 @@
 #include <climits>
 #include <condition_variable>
 #include <cstdlib>
+#include <cstring>
 #include <iostream>
 #include <memory>
+#include <string>
 #include <sstream>
 #include <thread>
 
@@ -1102,8 +1104,7 @@ public:
 
         LOG_TRC("Sending back painted tiles for " << tileMsg << " of size " << output.size() << " bytes) for: " << tileMsg);
 
-        std::shared_ptr<std::vector<char>> response = std::make_shared<std::vector<char>>();
-        response->resize(tileMsg.size() + output.size());
+        std::shared_ptr<std::vector<char>> response = std::make_shared<std::vector<char>>(tileMsg.size() + output.size());
         std::copy(tileMsg.begin(), tileMsg.end(), response->begin());
         std::copy(output.begin(), output.end(), response->begin() + tileMsg.size());
 
commit 242df1594dd9283ba0501b141e176617b03cf3d9
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Apr 20 11:39:20 2019 -0400
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Sat Apr 27 15:43:10 2019 +0100

    wsd: reuse ostringstream when logging
    
    This is faster and reduces memory fragmentation.
    
    Also, cleans up the logging macros and implementation.
    
    Change-Id: I7fb00da041d1261c694c4b48b67a3c66ad0cbf8d
    Reviewed-on: https://gerrit.libreoffice.org/71020
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>
    Signed-off-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/common/Log.cpp b/common/Log.cpp
index a5f101e93..3bedaa82e 100644
--- a/common/Log.cpp
+++ b/common/Log.cpp
@@ -131,6 +131,21 @@ namespace Log
         return buffer;
     }
 
+    // Reuse the same buffer to minimize memory fragmentation.
+    static thread_local std::ostringstream Oss;
+
+    std::ostringstream& begin(const char* level)
+    {
+        // Reset the oss.
+        Oss.clear();
+        Oss.seekp(0);
+
+        // Output the prefix.
+        char buffer[1024];
+        Oss << Log::prefix(buffer, sizeof(buffer) - 1, level) << std::boolalpha;
+        return Oss;
+    }
+
     void signalLogPrefix()
     {
         char buffer[1024];
diff --git a/common/Log.hpp b/common/Log.hpp
index bf05fc7ce..9ded1425a 100644
--- a/common/Log.hpp
+++ b/common/Log.hpp
@@ -50,6 +50,9 @@ namespace Log
 
     char* prefix(char* buffer, std::size_t len, const char* level);
 
+    /// Starts logging by generating the prefix and returning an oss.
+    std::ostringstream& begin(const char* level);
+
     inline bool traceEnabled() { return logger().trace(); }
     inline bool debugEnabled() { return logger().debug(); }
     inline bool infoEnabled() { return logger().information(); }
@@ -233,20 +236,19 @@ namespace Log
 #define LOG_FILE_NAME(f) (strrchr(f, '/')+1)
 #endif
 
-#define LOG_END(LOG, FILEP)                             \
-    do                                                  \
-    {                                                   \
-        if (FILEP)                                      \
-            LOG << "| " << LOG_FILE_NAME(__FILE__) << ':' << __LINE__; \
+#define LOG_END(LOG, FILEP)                                                                        \
+    do                                                                                             \
+    {                                                                                              \
+        if (FILEP)                                                                                 \
+            LOG << "| " << LOG_FILE_NAME(__FILE__) << ':' << __LINE__;                             \
     } while (false)
 
-#define LOG_BODY_(LOG, PRIO, LVL, X, FILEP)                                                 \
-    Poco::Message m_(LOG.name(), "", Poco::Message::PRIO_##PRIO);                           \
-    char b_[1024];                                                                          \
-    std::ostringstream oss_(Log::prefix(b_, sizeof(b_) - 1, LVL), std::ostringstream::ate); \
-    oss_ << std::boolalpha << X;                                                            \
-    LOG_END(oss_, FILEP);                                                                   \
-    m_.setText(oss_.str());                                                                 \
+#define LOG_BODY_(LOG, PRIO, LVL, X, FILEP)                                                        \
+    Poco::Message m_(LOG.name(), "", Poco::Message::PRIO_##PRIO);                                  \
+    std::ostringstream& oss_ = Log::begin(LVL);                                                    \
+    oss_ << X;                                                                                     \
+    LOG_END(oss_, FILEP);                                                                          \
+    m_.setText(oss_.str());                                                                        \
     LOG.log(m_);
 
 #define LOG_TRC(X)                                  \
commit 2ac2bf1ae1439421432ee05716c2ea3cf80ab2b2
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Apr 20 15:23:32 2019 -0400
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Sat Apr 27 15:42:57 2019 +0100

    wsd: use thread_local instead of __thread
    
    The former is the standard C++ approach
    and is reportedly faster than __thread
    (at least with gcc).
    
    Change-Id: Ibdefd32172774a280637f73dd062282b7bf62025
    Reviewed-on: https://gerrit.libreoffice.org/71019
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>
    Signed-off-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/common/Util.cpp b/common/Util.cpp
index 44a39fea8..ccde3c0d7 100644
--- a/common/Util.cpp
+++ b/common/Util.cpp
@@ -499,7 +499,7 @@ namespace Util
         return replace(r, "\n", " / ");
     }
 
-    static __thread char ThreadName[32] = {0};
+    static thread_local char ThreadName[32] = {0};
 
     void setThreadName(const std::string& s)
     {
@@ -539,7 +539,7 @@ namespace Util
     }
 
 #ifdef __linux
-    static __thread pid_t ThreadTid = 0;
+    static thread_local pid_t ThreadTid = 0;
 
     pid_t getThreadId()
 #else
commit b5efa32d9eb3c467be4cb92be80ac413938dba92
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Fri Apr 19 20:09:22 2019 -0400
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Sat Apr 27 15:42:46 2019 +0100

    wsd: use fast deflate level for png
    
    The default deflate level of 6 is quite slow
    and the benefits are hardly worth the high
    latency that users experience.
    
    Tested on a writer document with some small
    images and a few pages of text:
    
    Level 4 gives virtually identical compression
    ratio to level 6, but is between 5-10% faster.
    
    Level 3 runs almost twice as fast as level 6,
    but the output is typically 2-3x larger.
    
    Perhaps this should be exposed via config
    so it would be possible to reduce latency
    due to compression when CPU is scarce but
    network bandwidth ample, and vice versa.
    
    Change-Id: Iba88eea8f180d11458b33c68389e797234df1a60
    Reviewed-on: https://gerrit.libreoffice.org/71018
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>
    Signed-off-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/common/Png.hpp b/common/Png.hpp
index f75254852..62e24357d 100644
--- a/common/Png.hpp
+++ b/common/Png.hpp
@@ -136,6 +136,12 @@ bool encodeSubBufferToPNG(unsigned char* pixmap, size_t startX, size_t startY,
 
 #ifdef MOBILEAPP
     png_set_compression_level(png_ptr, Z_BEST_SPEED);
+#else
+    // Level 4 gives virtually identical compression
+    // ratio to level 6, but is between 5-10% faster.
+    // Level 3 runs almost twice as fast, but the
+    // output is typically 2-3x larger.
+    png_set_compression_level(png_ptr, 4);
 #endif
 
 #ifdef IOS
commit 4b2f9bef15a53f76de94e5a4efa3d21f62bab818
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Fri Apr 19 20:06:27 2019 -0400
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Sat Apr 27 15:42:33 2019 +0100

    wsd: logging, comments, and const correctness
    
    Change-Id: Ibfbef282e951a80fb145239df4bbcc9f3e4c8e13
    Reviewed-on: https://gerrit.libreoffice.org/71017
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>
    Signed-off-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/common/Png.hpp b/common/Png.hpp
index 0d40a37a0..f75254852 100644
--- a/common/Png.hpp
+++ b/common/Png.hpp
@@ -173,7 +173,9 @@ bool encodeSubBufferToPNG(unsigned char* pixmap, size_t startX, size_t startY,
 
     totalDuration += duration;
     nCalls += 1;
-    LOG_TRC("Average PNG compression time after " << std::to_string(nCalls) << " calls: " << (totalDuration / static_cast<double>(nCalls)));
+    LOG_TRC("PNG compression took " << duration << " ms (" << output.size()
+                                    << " bytes). Average after " << std::to_string(nCalls)
+                                    << " calls: " << (totalDuration / static_cast<double>(nCalls)));
 
     png_destroy_write_struct(&png_ptr, &info_ptr);
 
diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index a8ab8fe2d..6b45c8534 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -430,7 +430,6 @@ private:
             return _wireId;
         }
     } ;
-
     size_t _cacheSize;
     static const size_t CacheSizeSoftLimit = (1024 * 4 * 32); // 128k of cache
     static const size_t CacheSizeHardLimit = CacheSizeSoftLimit * 2;
@@ -474,9 +473,9 @@ private:
             for (auto it = _cache.begin(); it != _cache.end(); ++it)
                 avgHits += it->second.getHitCount();
 
-            LOG_DBG("cache " << _cache.size() << " items total size " <<
-                    _cacheSize << " current hits " << avgHits << ", total hit rate " <<
-                    (_cacheHits * 100. / _cacheTests) << "% at balance start");
+            LOG_DBG("PNG cache has " << _cache.size() << " items, total size " <<
+                    _cacheSize << ", current hits " << avgHits << ", total hit rate " <<
+                    (_cacheHits * 100. / _cacheTests) << "% at balance start.");
             avgHits /= _cache.size();
 
             for (auto it = _cache.begin(); it != _cache.end();)
@@ -502,8 +501,8 @@ private:
                 }
             }
 
-            LOG_DBG("cache " << _cache.size() << " items total size " <<
-                    _cacheSize << " after balance");
+            LOG_DBG("PNG cache has " << _cache.size() << " items, total size " <<
+                    _cacheSize << " after balance.");
         }
     }
 
commit 35a21fd0e5902ee256e624ecb0589b7c013e985f
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Tue Apr 2 10:26:02 2019 -0400
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Sat Apr 27 15:37:38 2019 +0100

    fix build: "sockaddr_un addrunix’ has incomplete type ...
    
    and cannot be defined"
    
    Change-Id: I2c136fc47c800ec3efd6268b4601100033e22724

diff --git a/net/Socket.cpp b/net/Socket.cpp
index 3ef0a4df1..f3492c37f 100644
--- a/net/Socket.cpp
+++ b/net/Socket.cpp
@@ -17,6 +17,7 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <sys/types.h>
+#include <sys/un.h>
 #include <zlib.h>
 
 #include <Poco/DateTime.h>


More information about the Libreoffice-commits mailing list