From 412a9c9f6719a6c62e8f5b6265714428d2ad4013 Mon Sep 17 00:00:00 2001 From: Jade Lovelace Date: Mon, 18 Mar 2024 23:03:48 -0700 Subject: Enable clang build timing analysis I didn't enable this by default for clang due to making the build time 10% worse or so. Unfortunate, but tbh devs for whom 10% of build time is not *that* bad should probably simply enable this. Change-Id: I8d1e5b6f3f76c649a4e2f115f534f7f97cee46e6 --- maintainers/buildtime_report.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 maintainers/buildtime_report.sh (limited to 'maintainers') diff --git a/maintainers/buildtime_report.sh b/maintainers/buildtime_report.sh new file mode 100755 index 000000000..54ce75eb5 --- /dev/null +++ b/maintainers/buildtime_report.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# Generates a report of build time based on a meson build using -ftime-trace in +# Clang. +if [ $# -lt 1 ]; then + echo "usage: $0 BUILD-DIR [filename]" >&2 + exit 1 +fi + +scriptdir=$(cd "$(dirname -- "$0")" || exit ; pwd -P) +filename=${2:-$scriptdir/../buildtime.bin} + +if [ "$(meson introspect "$1" --buildoptions | jq -r '.[] | select(.name == "profile-build") | .value')" != enabled ]; then + echo 'This build was not done with profile-build enabled, so cannot generate a report' >&2 + # shellcheck disable=SC2016 + echo 'Run `meson configure build -Dprofile-build=enabled` then rebuild, first' >&2 + exit 1 +fi + +ClangBuildAnalyzer --all "$1" "$filename" && ClangBuildAnalyzer --analyze "$filename" -- cgit v1.2.3