loolwsd/LOOLStress.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
New commits: commit 7ae28d5642cb99595b804561ebcd034a96f12706 Author: Ashod Nakashian <ashod.nakash...@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 <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@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") _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits