Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1e7a791f authored by Chirayu Desai's avatar Chirayu Desai Committed by Gerrit Code Review
Browse files

envsetup: mka improvements

Use make -j -l y instead of just make -j x
x is threads, y is 2*threads
This way make builds with the maximum number of jobs it can
while not getting the load average above y
I've tested it with 8 (x on my pc), 16, 20 and 24, and
2*threads seemed to be the most efficient

*needs more testing*

Change-Id: Ifd72e699a6fadc08442472defcc764fb91179355
parent 9adfbdd0
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -11,11 +11,11 @@ Invoke ". build/envsetup.sh" from your shell to add the following functions to y
- jgrep:   Greps on all local Java files.
- resgrep: Greps on all local res/*.xml files.
- godir:   Go to the directory containing a file.
- cmremote: Add git remote for CM Gerrit Review
- cmgerrit: A Git wrapper that fetches/pushes patch from/to CM Gerrit Review
- cmrebase: Rebase a Gerrit change and push it again
- mka:      Builds using SCHED_BATCH on all processors
- reposync: Parallel repo sync using ionice and SCHED_BATCH
- cmremote: Add git remote for CM Gerrit Review.
- cmgerrit: A Git wrapper that fetches/pushes patch from/to CM Gerrit Review.
- cmrebase: Rebase a Gerrit change and push it again.
- mka:      Builds using SCHED_BATCH on all processors.
- reposync: Parallel repo sync using ionice and SCHED_BATCH.

Look at the source to view more functions. The complete list is:
EOF
@@ -1604,10 +1604,14 @@ function cmrebase() {
function mka() {
    case `uname -s` in
        Darwin)
            make -j `sysctl hw.ncpu|cut -d" " -f2` "$@"
            local threads=`sysctl hw.ncpu|cut -d" " -f2`
            local load=`expr $threads \* 2`
            make -j -l $load  "$@"
            ;;
        *)
            schedtool -B -n 1 -e ionice -n 1 make -j `cat /proc/cpuinfo | grep "^processor" | wc -l` "$@"
            local threads=`grep "^processor" /proc/cpuinfo | wc -l`
            local load=`expr $threads \* 2`
            schedtool -B -n 1 -e ionice -n 1 make -j -l $load "$@"
            ;;
    esac
}