[Libreoffice-commits] online.git: loolwsd/test

Ashod Nakashian ashod.nakashian at collabora.co.uk
Sat May 21 03:47:57 UTC 2016


 loolwsd/test/UnitPrefork.cpp |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

New commits:
commit 9347adc66f6b48430013e81ec3843c86954c3533
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Fri May 20 23:08:00 2016 -0400

    loolwsd: UnitPrefork can't use the more recent child
    
    Change-Id: I6f60761498e61d9ceb48bc5f9a41967152293590
    Reviewed-on: https://gerrit.libreoffice.org/25246
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/test/UnitPrefork.cpp b/loolwsd/test/UnitPrefork.cpp
index 9c5766b..cd4bed0 100644
--- a/loolwsd/test/UnitPrefork.cpp
+++ b/loolwsd/test/UnitPrefork.cpp
@@ -32,7 +32,6 @@ const int NumToPrefork = 20;
 // Inside the WSD process
 class UnitPrefork : public UnitWSD
 {
-    int _numStarted;
     std::string _failure;
     Poco::Timestamp _startTime;
     size_t _totalPSS;
@@ -43,8 +42,7 @@ class UnitPrefork : public UnitWSD
 
 public:
     UnitPrefork()
-        : _numStarted(0),
-          _totalPSS(0),
+        : _totalPSS(0),
           _totalDirty(0)
     {
         setHasKitHooks();
@@ -99,6 +97,7 @@ public:
         if (_cv.wait_for(lock, std::chrono::milliseconds(5 * 1000)) == std::cv_status::timeout)
         {
             _failure = "Timed out waiting for child to respond to unit-memdump.";
+            Log::error(_failure);
         }
 
         totalPSS = _totalPSS;
@@ -107,19 +106,21 @@ public:
 
     virtual void newChild(const std::shared_ptr<Poco::Net::WebSocket> &socket) override
     {
-        ++_numStarted;
         _childSockets.push_back(socket);
-        if (_numStarted >= NumToPrefork)
+        if (_childSockets.size() > NumToPrefork)
         {
             Poco::Timestamp::TimeDiff elapsed = _startTime.elapsed();
 
             auto totalTime = (1000. * elapsed)/Poco::Timestamp::resolution();
-            Log::info() << "Launched " << _numStarted << " in "
+            Log::info() << "Launched " << _childSockets.size() << " in "
                         << totalTime << Log::end;
             size_t totalPSSKb = 0;
             size_t totalDirtyKb = 0;
-            for (auto child : _childSockets)
-                getMemory(child, totalPSSKb, totalDirtyKb);
+            // Skip the last one as it's not completely initialized yet.
+            for (size_t i = 0; i < _childSockets.size() - 1; ++i)
+            {
+                getMemory(_childSockets[i], totalPSSKb, totalDirtyKb);
+            }
 
             Log::info() << "Memory use total   " << totalPSSKb << "k shared "
                         << totalDirtyKb << "k dirty" << Log::end;


More information about the Libreoffice-commits mailing list