[Libreoffice-commits] online.git: 3 commits - loolwsd/LOOLSession.cpp loolwsd/LOOLWSD.cpp loolwsd/tsqueue.h loolwsd/Util.cpp

Jan Holesovsky kendy at collabora.com
Fri Nov 6 09:30:38 PST 2015


 loolwsd/LOOLSession.cpp |    3 +++
 loolwsd/LOOLWSD.cpp     |    5 +++--
 loolwsd/Util.cpp        |   20 ++++++++++----------
 loolwsd/tsqueue.h       |    1 +
 4 files changed, 17 insertions(+), 12 deletions(-)

New commits:
commit dfcaaf91aa673d542bcc8a5f13237a5e3b042d34
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Nov 6 18:24:22 2015 +0100

    loolwsd: Remove the tiles also from the child's queue.
    
    The commands leave the parent's queue very quickly, the child's queue is the
    critical one, so remove them also from there.  This speeds up the typing
    experience very considerably.

diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 3ca5c6f..e1cf3d0 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -404,7 +404,7 @@ public:
                                 session->handleInput(buffer, n);
                             }
                             // Filter out duplicated tile messages.
-                            else if (firstLine.find("tile") != 0 || !queue.alreadyInQueue(firstLine))
+                            else if ((firstLine.compare(0, 5, "tile ") != 0) || !queue.alreadyInQueue(firstLine))
                             {
                                 queue.put(firstLine);
                             }
@@ -958,7 +958,8 @@ void LOOLWSD::componentMain()
                         return (x.find("tile ") == 0 && x.find("id=") == std::string::npos);
                     });
                 }
-                else
+                // Filter out duplicated tile messages.
+                else if ((firstLine.compare(0, 5, "tile ") != 0) || !queue.alreadyInQueue(firstLine))
                 {
                     queue.put(firstLine);
                 }
diff --git a/loolwsd/tsqueue.h b/loolwsd/tsqueue.h
index 25c2ac2..94a36cd 100644
--- a/loolwsd/tsqueue.h
+++ b/loolwsd/tsqueue.h
@@ -55,6 +55,7 @@ public:
     }
 
     bool alreadyInQueue(std::string cmd) {
+        std::unique_lock<std::mutex> lock(_mutex);
         for (auto it = _queue.cbegin(); it != _queue.cend(); ++it) {
             if (cmd == *it) {
                 return true;
commit c44e0a62664b96237d4707a8013959eab6cf772c
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Nov 6 13:33:11 2015 +0100

    loolwsd: Log the tile rendering times.

diff --git a/loolwsd/LOOLSession.cpp b/loolwsd/LOOLSession.cpp
index 8b6da93..63380bc 100644
--- a/loolwsd/LOOLSession.cpp
+++ b/loolwsd/LOOLSession.cpp
@@ -1045,7 +1045,10 @@ void ChildProcessSession::sendTile(const char* /*buffer*/, int /*length*/, Strin
     if (_docType != "text" && part != _loKitDocument->pClass->getPart(_loKitDocument)) {
         _loKitDocument->pClass->setPart(_loKitDocument, part);
     }
+
+    Poco::Timestamp timestamp;
     _loKitDocument->pClass->paintTile(_loKitDocument, pixmap, width, height, tilePosX, tilePosY, tileWidth, tileHeight);
+    std::cout << Util::logPrefix() << "paintTile called, tile at [" << tilePosX << ", " << tilePosY << "] rendered in " << double(timestamp.elapsed())/1000 <<  "ms" << std::endl;
 
     if (!Util::encodePNGAndAppendToBuffer(pixmap, width, height, output))
     {
commit 37cb3c247a17e94a0ca5c68b5761cd3a8ef952da
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Nov 6 13:31:06 2015 +0100

    loolwsd: We have only ms resolution anyway, clean this up.

diff --git a/loolwsd/Util.cpp b/loolwsd/Util.cpp
index cac9c33..c1836cd 100644
--- a/loolwsd/Util.cpp
+++ b/loolwsd/Util.cpp
@@ -50,23 +50,23 @@ extern "C"
 
 namespace Util
 {
-    static const Poco::Int64 epochStart = Poco::Timestamp().utcTime();
+    static const Poco::Int64 epochStart = Poco::Timestamp().epochMicroseconds();
 
     std::string logPrefix()
     {
-        Poco::Int64 nanosec100 = Poco::Timestamp().utcTime() - epochStart;
+        Poco::Int64 usec = Poco::Timestamp().epochMicroseconds() - epochStart;
 
-        const Poco::Int64 n100 = 10000000;
-        Poco::Int64 hours = nanosec100 / (n100*60*60);
-        nanosec100 %= (n100*60*60);
-        Poco::Int64 minutes = nanosec100 / (n100*60);
-        nanosec100 %= (n100*60);
-        Poco::Int64 seconds = nanosec100 / (n100);
-        nanosec100 %= (n100);
+        const Poco::Int64 one_s = 1000000;
+        Poco::Int64 hours = usec / (one_s*60*60);
+        usec %= (one_s*60*60);
+        Poco::Int64 minutes = usec / (one_s*60);
+        usec %= (one_s*60);
+        Poco::Int64 seconds = usec / (one_s);
+        usec %= (one_s);
 
         std::ostringstream stream;
         stream << Poco::Process::id() << "," << std::setw(2) << std::setfill('0') << (Poco::Thread::current() ? Poco::Thread::current()->id() : 0) << "," <<
-            std::setw(2) << hours << ":" << std::setw(2) << minutes << ":" << std::setw(2) << seconds << "." << std::setw(7) << nanosec100 << ",";
+            std::setw(2) << hours << ":" << std::setw(2) << minutes << ":" << std::setw(2) << seconds << "." << std::setw(6) << usec << ",";
 
         return stream.str();
     }


More information about the Libreoffice-commits mailing list