aboutsummaryrefslogtreecommitdiff
path: root/src/zenmaster
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2025-10-10 14:28:12 +0200
committerStefan Boberg <[email protected]>2025-10-10 14:28:12 +0200
commit203a75987aa05964995047219383b3e6ef9f16b6 (patch)
treef1d0ae0e22ec9f99df9da6b83deb22f1b0d65a45 /src/zenmaster
parentminor tweak to overall timing (diff)
downloadzen-203a75987aa05964995047219383b3e6ef9f16b6.tar.xz
zen-203a75987aa05964995047219383b3e6ef9f16b6.zip
made server count dynamic via `--count` argument
Diffstat (limited to 'src/zenmaster')
-rw-r--r--src/zenmaster/zenmaster.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/zenmaster/zenmaster.cpp b/src/zenmaster/zenmaster.cpp
index 22a2e12b0..02c01fc50 100644
--- a/src/zenmaster/zenmaster.cpp
+++ b/src/zenmaster/zenmaster.cpp
@@ -200,6 +200,9 @@ main(int argc, char** argv)
Options.add_options()("malloc", "Configure memory allocator subsystem", cxxopts::value(MemoryOptions)->default_value("mimalloc"));
Options.add_options()("help", "Show command line help");
+ int ServerSpawnCount = 100;
+ Options.add_options()("count", "Number of servers to spawn", cxxopts::value<int>(ServerSpawnCount));
+
#if ZEN_WITH_TRACE
// We only have this in options for command line help purposes - we parse these argument separately earlier using
// GetTraceOptionsFromCommandline()
@@ -345,13 +348,11 @@ main(int argc, char** argv)
ZEN_INFO("END {}, took {}", Tag, NiceTimeSpanMs(t.GetElapsedTimeMs()));
};
- int SpawnCount = 100;
-
std::vector<std::unique_ptr<ZenServerInstance>> Instances;
- TimedBlock(fmt::format("Spawning {} instances", SpawnCount), [&] {
+ TimedBlock(fmt::format("Spawning {} instances", ServerSpawnCount), [&] {
TimedBlock("Spawning instances", [&] {
- for (int i = 0; i < SpawnCount; ++i)
+ for (int i = 0; i < ServerSpawnCount; ++i)
{
auto& Instance = Instances.emplace_back(std::make_unique<ZenServerInstance>(TestEnv));
@@ -362,7 +363,7 @@ main(int argc, char** argv)
});
TimedBlock("Waiting for instances", [&] {
- for (int i = 0; i < SpawnCount; ++i)
+ for (int i = 0; i < ServerSpawnCount; ++i)
{
auto& Instance = Instances[i];
@@ -377,7 +378,7 @@ main(int argc, char** argv)
zen::getch();
TimedBlock("Shutting down instances", [&] {
- for (int i = 0; i < SpawnCount; ++i)
+ for (int i = 0; i < ServerSpawnCount; ++i)
{
auto& Instance = Instances[i];