[Libreoffice-commits] online.git: loolwsd/LOOLStress.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Fri Sep 16 12:31:31 UTC 2016


 loolwsd/LOOLStress.cpp |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit a0478719ffde1bbfd7994bd57665e40cb54982ce
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Fri Sep 2 17:50:59 2016 -0400

    loolwsd: benchmark iterations count as argument to the cli
    
    Change-Id: I2598937ec01dbc4672f88f86d642b32b1b000d91
    Reviewed-on: https://gerrit.libreoffice.org/28953
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/LOOLStress.cpp b/loolwsd/LOOLStress.cpp
index 237b4a0..fe9ca98 100644
--- a/loolwsd/LOOLStress.cpp
+++ b/loolwsd/LOOLStress.cpp
@@ -53,6 +53,7 @@ public:
     ~Stress() {}
 
     static bool Benchmark;
+    static int Iterations;
     static bool NoDelay;
     unsigned _numClients;
     std::string _serverURI;
@@ -246,13 +247,14 @@ private:
 
     void benchmark()
     {
+        std::cout << "Running " << Stress::Iterations << " iterations of Benchmark." << std::endl;
         static std::atomic<unsigned> SessionId;
         const auto sessionId = ++SessionId;
         auto connection = Connection::create(_app._serverURI, _uri, std::to_string(sessionId));
 
         connection->load();
 
-        for (auto i = 0; i < 10; ++i)
+        for (auto i = 0; i < Stress::Iterations; ++i)
         {
             renderTile(connection);
 
@@ -389,6 +391,7 @@ private:
 
 bool Stress::NoDelay = false;
 bool Stress::Benchmark = false;
+int Stress::Iterations = 100;
 
 Stress::Stress() :
     _numClients(1),
@@ -408,6 +411,9 @@ void Stress::defineOptions(OptionSet& optionSet)
                         .required(false).repeatable(false));
     optionSet.addOption(Option("bench", "", "Performance benchmark. The argument is a document URL to load.")
                         .required(false).repeatable(false));
+    optionSet.addOption(Option("iter", "", "Number of iterations to use for Benchmarking.")
+                        .required(false).repeatable(false)
+                        .argument("iter"));
     optionSet.addOption(Option("nodelay", "", "Replay at full speed disregarding original timing.")
                         .required(false).repeatable(false));
     optionSet.addOption(Option("clientsperdoc", "", "Number of simultaneous clients on each doc.")
@@ -435,6 +441,8 @@ void Stress::handleOption(const std::string& optionName,
     }
     else if (optionName == "bench")
         Stress::Benchmark = true;
+    else if (optionName == "iter")
+        Stress::Iterations = std::max(std::stoi(value), 10);
     else if (optionName == "nodelay")
         Stress::NoDelay = true;
     else if (optionName == "clientsperdoc")


More information about the Libreoffice-commits mailing list