diff options
author | Xy Ziemba <xyziemba@microsoft.com> | 2015-02-05 18:02:19 -0800 |
---|---|---|
committer | Xy Ziemba <xyziemba@microsoft.com> | 2015-02-05 18:09:55 -0800 |
commit | fe4bbc88babb3b01418c82540f3c716696e20fd1 (patch) | |
tree | 5a4ef0692174de42275075b305b69c653fac98a4 /build.sh | |
parent | 2c9e9e484a5f745d5392b925dd00c4b94aebfd16 (diff) | |
download | coreclr-fe4bbc88babb3b01418c82540f3c716696e20fd1.tar.gz coreclr-fe4bbc88babb3b01418c82540f3c716696e20fd1.tar.bz2 coreclr-fe4bbc88babb3b01418c82540f3c716696e20fd1.zip |
Use # of processors availabe to OS scheduler on Linux
`getconf _NPROCESSORS_ONLN` provides the number of cores available to
the OS scheduler, while `nproc` provides the number of cores available
to `nproc` itself. We want to use the former value since make spawns
new processes instead of running compilation tasks in the same process.
(FWIW, the two values are usually the same, but `getconf` gets us the
value that we actually want.)
Additionally, `getconf` is available on Mac OSX while `nproc` is not.
I also fixed the printout of the `make` command that's actually
executed when we build.
Diffstat (limited to 'build.sh')
-rwxr-xr-x | build.sh | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -77,11 +77,17 @@ build_coreclr() echo Failed to generate native component build project! exit 1 fi + + # Get the number of processors available to the scheduler + # Other techniques such as `nproc` only get the number of + # processors available to a single process. + NumProc=$(getconf _NPROCESSORS_ONLN) # Build CoreCLR - echo Executing make $__UnprocessedBuildArgs - make install -j `nproc` $__UnprocessedBuildArgs + echo Executing make install -j $NumProc $__UnprocessedBuildArgs + + make install -j $NumProc $__UnprocessedBuildArgs if [ $? != 0 ]; then echo Failed to build coreclr components. exit 1 |