From 578413a1f8781f03c2ddccb4d3c5d441c9579a3b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 4 Apr 2017 14:58:08 +0200 Subject: Add --cpu and --ram options --- bbot/agent.cli | 12 ++++++++++++ bbot/agent.cxx | 10 ++++++++++ bbot/bbot-agent@.service | 4 +++- 3 files changed, 25 insertions(+), 1 deletion(-) (limited to 'bbot') diff --git a/bbot/agent.cli b/bbot/agent.cli index a52579f..761580c 100644 --- a/bbot/agent.cli +++ b/bbot/agent.cli @@ -30,6 +30,18 @@ namespace bbot { "\h|OPTIONS|" + size_t --cpu = 1 + { + "", + "Number of CPUs (threads) to use, 1 by default." + }; + + size_t --ram (1024 * 1024) // 1G + { + "", + "Amount of RAM (in kB) to use, 1G by default." + }; + bool --help {"Print usage information and exit."} bool --version {"Print version and exit."} }; diff --git a/bbot/agent.cxx b/bbot/agent.cxx index 26b0073..8c281fe 100644 --- a/bbot/agent.cxx +++ b/bbot/agent.cxx @@ -99,6 +99,16 @@ try return p.wait () ? 0 : 1; } + if (argc != 2) + fail << "toolchain name excected" << + info << "run " << argv[0] << " --help for details"; + + string tc (argv[1]); + + info << "starting bbot agent for toolchain " << tc << + info << ops.cpu () << " CPU(s)" << + info << ops.ram () << " RAM(kB)"; + for (;;) { error << "sleeping" << diff --git a/bbot/bbot-agent@.service b/bbot/bbot-agent@.service index 8b3b7a3..64e07d2 100644 --- a/bbot/bbot-agent@.service +++ b/bbot/bbot-agent@.service @@ -4,7 +4,9 @@ After=default.target [Service] Type=simple -ExecStart=/build/toolchains/%i/bin/bbot-agent %i +Environment=CPU=1 +Environment=RAM=1048576 +ExecStart=/build/bbot/%i/bin/bbot-agent --cpu ${CPU} --ram ${RAM} %i User=build Group=build WorkingDirectory=~ -- cgit v1.1