aboutsummaryrefslogtreecommitdiff
path: root/bbot
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-04-04 14:58:08 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-04-04 14:58:08 +0200
commit578413a1f8781f03c2ddccb4d3c5d441c9579a3b (patch)
treee09764195dbf2027f6bd3f9be3b0d280c99b9340 /bbot
parent1af66bf90d14ec32ec0df5fe266674bd08ecf5e1 (diff)
Add --cpu and --ram options
Diffstat (limited to 'bbot')
-rw-r--r--bbot/agent.cli12
-rw-r--r--bbot/agent.cxx10
-rw-r--r--bbot/bbot-agent@.service4
3 files changed, 25 insertions, 1 deletions
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
+ {
+ "<num>",
+ "Number of CPUs (threads) to use, 1 by default."
+ };
+
+ size_t --ram (1024 * 1024) // 1G
+ {
+ "<num>",
+ "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=~