aboutsummaryrefslogtreecommitdiff
path: root/bbot/agent/agent.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'bbot/agent/agent.cxx')
-rw-r--r--bbot/agent/agent.cxx16
1 files changed, 13 insertions, 3 deletions
diff --git a/bbot/agent/agent.cxx b/bbot/agent/agent.cxx
index 67cf57f..9aba216 100644
--- a/bbot/agent/agent.cxx
+++ b/bbot/agent/agent.cxx
@@ -23,6 +23,7 @@
#include <map>
#include <atomic>
#include <chrono>
+#include <thread> // thread::hardware_concurrency()
#include <random>
#include <iomanip> // setw()
#include <iostream>
@@ -1250,7 +1251,8 @@ perform_task (toolchain_lock tl, // Note: assumes ownership.
machine_lock& ml,
const dir_path& md,
const bootstrapped_machine_manifest& mm,
- const task_manifest& tm)
+ const task_manifest& tm,
+ optional<size_t> boost_cpus)
try
{
tracer trace ("perform_task", md.string ().c_str ());
@@ -1399,7 +1401,8 @@ try
mm.machine.mac,
ops.bridge (),
tftpd.port (),
- tm.interactive.has_value ()));
+ tm.interactive.has_value (),
+ boost_cpus));
auto mg (
make_exception_guard (
@@ -2525,8 +2528,15 @@ try
}
}
+ // Check if we need to boost the number of CPUs to the full hardware
+ // concurrency.
+ //
+ optional<size_t> bcpus;
+ if (prio >= 10000)
+ bcpus = std::thread::hardware_concurrency ();
+
pm->lock.perform_task (tl, prio);
- r = perform_task (move (tl), pm->lock, pm->path, pm->manifest, t);
+ r = perform_task (move (tl), pm->lock, pm->path, pm->manifest, t, bcpus);
}
catch (const interrupt&)
{