summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-11-04 16:42:12 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2017-11-04 16:42:12 +0000
commit13c27c35937d0a565855d25d2923b556b2e66e5b (patch)
treee9ba079af0a02509f2ca8bd6bea4dcb3bca8e450
parentAdd alias for reporting on binary sizes (diff)
downloadutil-13c27c35937d0a565855d25d2923b556b2e66e5b.tar.bz2
util-13c27c35937d0a565855d25d2923b556b2e66e5b.tar.xz
util-13c27c35937d0a565855d25d2923b556b2e66e5b.zip
Take threads and cores into account when calculating the number parallel tasks to run
-rw-r--r--bashrc4
1 files changed, 3 insertions, 1 deletions
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/\~}"