util/abuild: Add per-build statistics tarfile

Change-Id: Icb9a5bdf94013fe493dc8ec634cf3094bcff2838
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/75803
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Kyösti Mälkki 2023-06-10 19:46:31 +03:00 committed by Martin L Roth
parent 572db7f4c7
commit 6a50e555fc
1 changed files with 19 additions and 1 deletions

View File

@ -420,9 +420,15 @@ function compile_target
cd "${build_dir}" || return $? cd "${build_dir}" || return $?
timestamps="abuild.timestamps"
printf "Build started %s\n" "${ts_basetime_str}" > "${timestamps}"
printf "BASETIME_SECONDS %d\n" $ts_exec_shell >> "${timestamps}"
printf "TS_0 %d\n" $ts_0 >> "${timestamps}"
printf "TS_1 %d\n" $ts_1 >> "${timestamps}"
printf "TS_2 %d\n" $ts_2 >> "${timestamps}"
duration=$(ts_delta_seconds $ts_0 $ts_2) duration=$(ts_delta_seconds $ts_0 $ts_2)
duration_str=$(ts_delta_string $ts_0 $ts_2) duration_str=$(ts_delta_string $ts_0 $ts_2)
junit " <testcase classname='${TESTRUN}${testclass/#/.}' name='$BUILD_NAME' time='$duration' >" junit " <testcase classname='${TESTRUN}${testclass/#/.}' name='$BUILD_NAME' time='$duration' >"
if [ $MAKE_FAILED -eq 0 ]; then if [ $MAKE_FAILED -eq 0 ]; then
@ -452,6 +458,13 @@ function compile_target
sort "${build_dir}/config.h" | grep CONFIG_ > "${build_dir}/config.h.sorted" sort "${build_dir}/config.h" | grep CONFIG_ > "${build_dir}/config.h.sorted"
sha256sum "${build_dir}/config.h.sorted" >> "${checksum_file}_config" sha256sum "${build_dir}/config.h.sorted" >> "${checksum_file}_config"
fi fi
stats_files="${build_dir}/${timestamps}"
if [ -f ${build_dir}/ccache.stats ]; then
stats_files="${stats_files} ${build_dir}/ccache.stats"
fi
flock -F -w 0.1 $TARGET/.statslock tar -rf ${stats_archive} ${stats_files} 2> /dev/null
if [ "$clean_work" = "true" ]; then if [ "$clean_work" = "true" ]; then
rm -rf "${build_dir}" rm -rf "${build_dir}"
fi fi
@ -914,6 +927,8 @@ fi
FAILED_BOARDS="$(realpath ${TARGET}/failed_boards)" FAILED_BOARDS="$(realpath ${TARGET}/failed_boards)"
PASSED_BOARDS="$(realpath ${TARGET}/passing_boards)" PASSED_BOARDS="$(realpath ${TARGET}/passing_boards)"
stats_archive="$TARGET/statistics.tar"
# Generate a single xcompile for all boards # Generate a single xcompile for all boards
export xcompile="${TARGET}/xcompile" export xcompile="${TARGET}/xcompile"
@ -921,6 +936,9 @@ if [ "$recursive" = "false" ]; then
rm -f "${xcompile}" rm -f "${xcompile}"
$MAKE -C"${ROOT}" obj="$TARGET/temp" objutil="$TARGET/sharedutils" UPDATED_SUBMODULES=1 "${xcompile}" || exit 1 $MAKE -C"${ROOT}" obj="$TARGET/temp" objutil="$TARGET/sharedutils" UPDATED_SUBMODULES=1 "${xcompile}" || exit 1
rm -f "$FAILED_BOARDS" "$PASSED_BOARDS" rm -f "$FAILED_BOARDS" "$PASSED_BOARDS"
# Initialize empty statistics archive
tar -cf "${stats_archive}" "${xcompile}" 2> /dev/null
fi fi
USE_XARGS=0 USE_XARGS=0