Files
openwrt/scripts/build-time-log.sh
T
John Crispin b95b0928ac build: add per stage build time profiling
Set BUILD_TIME_LOG=<file> to record a begin and an end event for every
prepare, configure, compile and install stage of every tool, toolchain
component, kernel and package. scripts/build-time-report.pl turns the log
into a report.

The report divides each second of the build between the stages that run
in it, so the numbers show which stages hold up the wall clock rather
than which ones burn the most CPU. Nothing is recorded and no extra
process runs when BUILD_TIME_LOG is unset.

Signed-off-by: John Crispin <john@phrozen.org>
2026-09-22 18:18:58 +02:00

19 lines
368 B
Bash
Executable File

#!/bin/sh
#
# SPDX-License-Identifier: GPL-2.0-only
#
# Records one build stage event. See scripts/build-time-report.pl.
#
# Usage: build-time-log.sh <logfile> <begin|end> <stage> <name>
[ $# -eq 4 ] || exit 0
now=$(date +%s.%N 2>/dev/null)
case "$now" in
''|*N*) now=$(date +%s) ;;
esac
printf '%s\t%s\t%s\t%s\n' "$now" "$2" "$3" "$4" >> "$1" 2>/dev/null
exit 0