2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-17 13:42:14 +00:00

Default to available cpu threads for -j option.

This adds a `b2::system_info` class to obtain available information on
system we are running in. Currently provides CPU counts.
And currently only implemented for macOS.
This commit is contained in:
Rene Rivera
2019-06-03 18:39:22 -05:00
parent a5cc06a9b4
commit 150d69bd57
7 changed files with 120 additions and 5 deletions

View File

@@ -134,6 +134,7 @@
#include "timestamp.h"
#include "variable.h"
#include "execcmd.h"
#include "sysinfo.h"
/* Macintosh is "special" */
#ifdef OS_MAC
@@ -373,6 +374,11 @@ int main( int argc, char * * argv, char * * arg_environ )
return EXITOK;
}
/* Set default parallel jobs to match cpu threads. This can be overridden
the usual way with -jX or PARALLELISM env var. */
b2::system_info sys_info;
globs.jobs = sys_info.cpu_thread_count();
/* Pick up interesting options. */
if ( ( s = getoptval( optv, 'n', 0 ) ) )
{