From 31b8aa3c83f2bb1cd448c40677a1eb8266dad2ce Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 15 May 2023 11:58:53 +0200 Subject: Add CPU boosting for higher 4th priority levels --- bbot/agent/agent.cxx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'bbot/agent/agent.cxx') 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 #include #include +#include // thread::hardware_concurrency() #include #include // setw() #include @@ -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 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 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&) { -- cgit v1.1