mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-28 05:06:43 +00:00
build: add load average limit to reduce CPU overcommitment
For make and ninja based build systems, no new jobs are started if the load average is greater than number_of_cores * 1.5.
This commit is contained in:
parent
f58d0c7a0b
commit
2d12b7ebe8
@ -250,19 +250,26 @@ setup_toolchain() {
|
|||||||
|
|
||||||
# parallel
|
# parallel
|
||||||
if flag_enabled "parallel" "yes"; then
|
if flag_enabled "parallel" "yes"; then
|
||||||
NINJA_OPTS="$NINJA_OPTS -j$CONCURRENCY_MAKE_LEVEL"
|
NINJA_OPTS="-j$CONCURRENCY_MAKE_LEVEL"
|
||||||
export MAKEFLAGS="-j$CONCURRENCY_MAKE_LEVEL"
|
MAKEFLAGS="-j$CONCURRENCY_MAKE_LEVEL"
|
||||||
else
|
else
|
||||||
NINJA_OPTS="$NINJA_OPTS -j1"
|
NINJA_OPTS="-j1"
|
||||||
export MAKEFLAGS="-j1"
|
MAKEFLAGS="-j1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# verbose flag
|
# verbose flag
|
||||||
if flag_enabled "verbose" "no"; then
|
if flag_enabled "verbose" "no"; then
|
||||||
NINJA_OPTS="$NINJA_OPTS -v"
|
NINJA_OPTS+=" -v"
|
||||||
export MAKEFLAGS="$MAKEFLAGS V=1 VERBOSE=1"
|
MAKEFLAGS+=" V=1 VERBOSE=1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# average load limit
|
||||||
|
if [ "${CONCURRENCY_LOAD}" != "0" ]; then
|
||||||
|
NINJA_OPTS+=" -l${CONCURRENCY_LOAD}"
|
||||||
|
MAKEFLAGS+=" -l${CONCURRENCY_LOAD}"
|
||||||
|
fi
|
||||||
|
export MAKEFLAGS
|
||||||
|
|
||||||
case "$1:$2" in
|
case "$1:$2" in
|
||||||
target:meson)
|
target:meson)
|
||||||
export DESTIMAGE="target"
|
export DESTIMAGE="target"
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
# Linker hash-style is set to gnu via gcc default
|
# Linker hash-style is set to gnu via gcc default
|
||||||
LD_OPTIM="-Wl,--as-needed"
|
LD_OPTIM="-Wl,--as-needed"
|
||||||
|
|
||||||
NINJA_OPTS=""
|
|
||||||
|
|
||||||
TARGET_CPPFLAGS=""
|
TARGET_CPPFLAGS=""
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -Wall -pipe $PROJECT_CFLAGS"
|
TARGET_CFLAGS="$TARGET_CFLAGS -Wall -pipe $PROJECT_CFLAGS"
|
||||||
TARGET_CXXFLAGS="$TARGET_CFLAGS"
|
TARGET_CXXFLAGS="$TARGET_CFLAGS"
|
||||||
|
@ -77,6 +77,7 @@ VERBOSE="${VERBOSE:-yes}"
|
|||||||
# Try values between 1 and number of processor cores present.
|
# Try values between 1 and number of processor cores present.
|
||||||
# default: use all cores
|
# default: use all cores
|
||||||
[ -z "${CONCURRENCY_MAKE_LEVEL}" ] && export CONCURRENCY_MAKE_LEVEL=$(nproc)
|
[ -z "${CONCURRENCY_MAKE_LEVEL}" ] && export CONCURRENCY_MAKE_LEVEL=$(nproc)
|
||||||
|
[ -z "${CONCURRENCY_LOAD}" ] && export CONCURRENCY_LOAD=$(python3 -c "import os; print('%.2f' % (os.cpu_count() * 1.5))")
|
||||||
|
|
||||||
# cache size for ccache
|
# cache size for ccache
|
||||||
# Set the maximum size of the files stored in the cache. You can specify a
|
# Set the maximum size of the files stored in the cache. You can specify a
|
||||||
|
Loading…
x
Reference in New Issue
Block a user