buildsystem: avoid process forks to init dashboard status file

A typical image build will update the dashboard 3500-4500 times. This change
avoids two process forks (cat, wc) per update, and the remaining $(< file) is
faster than $(cat file).
This commit is contained in:
MilhouseVH 2019-05-29 00:56:10 +01:00
parent 04b8036e32
commit 0bd4793492
2 changed files with 6 additions and 2 deletions

View File

@ -1322,8 +1322,11 @@ update_dashboard() {
sedline=$((MTJOBID + 2))
num=$(cat "${THREAD_CONTROL}/status" | wc -l)
while [ ${num} -lt ${sedline} ]; do echo "" >>"${THREAD_CONTROL}/status"; num=$((num + 1)); done
num=$(< "${THREAD_CONTROL}/status.max")
if [ ${num} -lt ${sedline} ]; then
echo ${sedline} >"${THREAD_CONTROL}/status.max"
for i in $(seq $((num + 1)) ${sedline}); do echo "" >>"${THREAD_CONTROL}/status"; done
fi
num=$(< "${THREAD_CONTROL}/progress.prev")
projdevarch="${PROJECT}/"

View File

@ -144,6 +144,7 @@ start_multithread_build() {
mkdir -p "${THREAD_CONTROL}/locks"
echo -1 >"${THREAD_CONTROL}/progress.prev"
echo 0 >"${THREAD_CONTROL}/progress"
echo 0 >"${THREAD_CONTROL}/status.max"
touch "${THREAD_CONTROL}/status"
[ "${THREADCOUNT}" = "0" ] && THREADCOUNT=1