[Libreoffice-commits] online.git: loolwsd/LOOLStress.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Mon Aug 8 03:55:24 UTC 2016
loolwsd/LOOLStress.cpp | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
New commits:
commit 7ae28d5642cb99595b804561ebcd034a96f12706
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Thu Aug 4 20:17:13 2016 -0400
loolstress: new option to replay without timing delays
Change-Id: Ic1f6c911f504128b7d1aa5e3ee2354e382b825c5
Reviewed-on: https://gerrit.libreoffice.org/27971
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 f042901..9b7981c 100644
--- a/loolwsd/LOOLStress.cpp
+++ b/loolwsd/LOOLStress.cpp
@@ -53,6 +53,7 @@ public:
Stress();
~Stress() {}
+ static bool NoDelay;
unsigned _numClients;
std::string _serverURI;
@@ -152,9 +153,14 @@ private:
const auto deltaCurrent = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::steady_clock::now() - epochCurrent).count();
const auto deltaFile = rec.TimestampNs - epochFile;
- const auto delay = deltaFile - deltaCurrent;
+ const auto delay = (Stress::NoDelay ? 0 : deltaFile - deltaCurrent);
if (delay > 0)
{
+ if (delay > 1e6)
+ {
+ std::cerr << "Sleeping for " << delay / 1000 << " ms.\n";
+ }
+
std::this_thread::sleep_for(std::chrono::microseconds(delay));
}
@@ -251,6 +257,8 @@ private:
std::map<std::string, std::map<std::string, std::unique_ptr<Connection>>> Sessions;
};
+bool Stress::NoDelay = false;
+
Stress::Stress() :
_numClients(1),
#if ENABLE_SSL
@@ -267,6 +275,8 @@ void Stress::defineOptions(OptionSet& optionSet)
optionSet.addOption(Option("help", "", "Display help information on command line arguments.")
.required(false).repeatable(false));
+ 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.")
.required(false).repeatable(false)
.argument("concurrency"));
@@ -290,6 +300,8 @@ void Stress::handleOption(const std::string& optionName,
helpFormatter.format(std::cout);
std::exit(Application::EXIT_OK);
}
+ else if (optionName == "nodelay")
+ Stress::NoDelay = true;
else if (optionName == "clientsperdoc")
_numClients = std::max(std::stoi(value), 1);
else if (optionName == "server")
More information about the Libreoffice-commits
mailing list