summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2012-05-15 15:51:44 -0500
committerJoel Sherrill <joel.sherrill@oarcorp.com>2012-05-15 15:51:44 -0500
commit8e204906d4d896b994ef9c2064c068a048d07179 (patch)
tree6d944aad3c2e1299039767de02d3422fff8fe3ee
parentEliminate missing prototype warnings in templates (diff)
downloadrtems-testing-8e204906d4d896b994ef9c2064c068a048d07179.tar.bz2
bit_rtems - Determine make parallel jobs dynamically
Use 1.5 * number of CPU cores + 1. If the getconf fails, assume the machine has 2 cores for a minimum of -j3. On a 4 core machine, this yields a -j7. The -j factor is not intended to be nice but to maximize the use of the machine.
-rwxr-xr-xrtems/bit_rtems14
1 files changed, 11 insertions, 3 deletions
diff --git a/rtems/bit_rtems b/rtems/bit_rtems
index a3c03dd..d1f9b99 100755
--- a/rtems/bit_rtems
+++ b/rtems/bit_rtems
@@ -383,16 +383,24 @@ if [ ${BUILD_RTEMS_DEBUG} = "yes" ] ; then
MAKE_DEBUG_ARG="VARIANT=DEBUG"
fi
+# Calculate number of jobs as 1.5*ncpus + 1
+ncpus=`/usr/bin/getconf _NPROCESSORS_ONLN 2>/dev/null`
+if [ $? -ne 0 ] ; then
+ ncpus=2
+fi
+njobs=`expr ${ncpus} / 2 + 1 + ${ncpus}`
+echo "Using make ${njobs} parallel jobs"
+
case ${BSP_TO_TEST} in
multilib)
echo "Executing ${MAKE} ${MAKE_DEBUG_ARG} ..."
- ${MAKE} -j8 RTEMS_BSP= ${MAKE_DEBUG_ARG}
+ ${MAKE} -j${njobs} RTEMS_BSP= ${MAKE_DEBUG_ARG}
check_fatal $? "failed ${MAKE} ${MAKE_DEBUG_ARG}."
BSP_TO_TEST=
;;
*)
echo "Executing ${MAKE} ${MAKE_DEBUG_ARG} ..."
- ${MAKE} -j8 RTEMS_BSP=${BSP_TO_TEST} ${MAKE_DEBUG_ARG}
+ ${MAKE} -j${njobs} RTEMS_BSP=${BSP_TO_TEST} ${MAKE_DEBUG_ARG}
check_fatal $? "failed ${MAKE} ${MAKE_DEBUG_ARG}."
;;
esac
@@ -439,7 +447,7 @@ case ${BSP_ARG} in
check_fatal $? "Unable to configure BSP step successfully"
echo "Executing multilib BSP: ${MAKE} ${MAKE_DEBUG_ARG} ..."
- ${MAKE} -k -j8 ${MAKE_DEBUG_ARG}
+ ${MAKE} -k -j${njobs} ${MAKE_DEBUG_ARG}
status=$?
# clean up install point