From 13c27c35937d0a565855d25d2923b556b2e66e5b Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 4 Nov 2017 16:42:12 +0000 Subject: Take threads and cores into account when calculating the number parallel tasks to run --- bashrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'bashrc') diff --git a/bashrc b/bashrc index 36640e7..01a8844 100644 --- a/bashrc +++ b/bashrc @@ -61,6 +61,8 @@ sizes() { PATH="/usr/lib/ccache/bin:$PATH" CORES=$(grep core\ id /proc/cpuinfo | sort -u | wc -l) +CPUS=$(grep core\ id /proc/cpuinfo -c) +TASKS=$((($CORES + $CPUS) / 2)) export FEATURES="ccache" alias :e="gvim" alias d="cd ~/dev" @@ -83,7 +85,7 @@ vg() { } build() { title "Build in progress" - CCACHE_BASEDIR=$(git root) nice -n5 b2 -j$CORES $@ + CCACHE_BASEDIR=$(git root) nice -n5 b2 -j$TASKS $@ rtn=$? if [ $rtn -eq 0 ]; then title "Build success ${PWD/#$HOME/\~}" -- cgit v1.2.3