From a43ae0d098da2b0a5d77b6ecbc578f6d14b22d55 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sat, 4 Sep 2021 10:38:41 +0200 Subject: pgo: replace meson-pgo.sh with several script primitives MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All scripts are in the ‘pgo’ directory: * options: command line options for generate-alt-random-writes.py, sourced by other scripts. * pgo.sh: top-level script, generates a meson build directory, selects a PGO method, generates the profiling data, re-configures the meson build directory and does the final build. This script is intended to be used by end-users, and shows _how_ to integrate the script primitives. Build servers will most likely *not* want to use this script as-is. * partial.sh: generates alt-random-write data and runs “foot{,client} --version”, and then feeds the alt-random data to the PGO helper binary. Does not require a running Wayland session. Touches $blddir/pgo-ok on success. * full-inner.sh: runs “footclient --version”, and then a complex “foot” command that first generates alt-random-write data, and then “cat’s” it. Requires a running Wayland session, *but*, this script is usually not called directly (see below). Touches $blddir/pgo-ok onsucces.. * full-current-session.sh: runs full-inner.sh. That is, it runs foot in the currently running Wayland session. Note that this will pop up a foot window. * full-headless-sway.sh: generates a custom Sway configuration that exec’s foot-headless-sway-inner.sh (see below), and then executes a headless Sway. In other words, this script does a *full* PGO build, but *without* requiring a running Wayland session. Requires Sway >= 1.6.2. * full-headless-sway.sh: runs full-inner.sh + “swaymsg exit”. To do a custom PGO build, without using pgo.sh, you’d need to: CFLAGS=”$CFLAGS -O3” meson --buildtype=release -Db_lto=true meson configure -Db_pgo=generate ninja ninja test (only needed if tllist+fcft are built as subprojects) Run *one* of: - partial.sh - full-current-session.sh - full-headless-sway.sh meson configure -D b_pgo=use ninja --- pgo/partial.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 pgo/partial.sh (limited to 'pgo/partial.sh') diff --git a/pgo/partial.sh b/pgo/partial.sh new file mode 100755 index 00000000..9cb8bd59 --- /dev/null +++ b/pgo/partial.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -eu + +srcdir=$(realpath "${1}") +blddir=$(realpath "${2}") + +. "${srcdir}"/pgo/options + +pgo_data=$(mktemp) +trap "rm -f ${pgo_data}" EXIT INT HUP TERM + +rm -f "${blddir}"/pgo-ok + +"${srcdir}"/scripts/generate-alt-random-writes.py \ + --rows=67 \ + --cols=135 \ + ${script_options} \ + "${pgo_data}" + +# To ensure profiling data is generated in the build directory +cd "${blddir}" + +"${blddir}"/footclient --version +"${blddir}"/foot --version +"${blddir}"/pgo "${pgo_data}" + +touch "${blddir}"/pgo-ok -- cgit v1.3 From 99c4e51e199f87c0b4d97d43a2d34af62c6b7ae4 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sat, 4 Sep 2021 11:14:09 +0200 Subject: pgo: add set -x to all PGO scripts Without this, debugging error reports from users is going to be _very_ difficult... --- pgo/full-current-session.sh | 2 +- pgo/full-headless-cage.sh | 2 +- pgo/full-headless-sway-inner.sh | 2 +- pgo/full-headless-sway.sh | 2 +- pgo/full-inner.sh | 4 ++-- pgo/partial.sh | 2 +- pgo/pgo.sh | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) (limited to 'pgo/partial.sh') diff --git a/pgo/full-current-session.sh b/pgo/full-current-session.sh index 3f62a6b5..363ee793 100755 --- a/pgo/full-current-session.sh +++ b/pgo/full-current-session.sh @@ -1,6 +1,6 @@ #!/bin/sh -set -eu +set -eux srcdir=$(realpath "${1}") blddir=$(realpath "${2}") diff --git a/pgo/full-headless-cage.sh b/pgo/full-headless-cage.sh index a4fd5699..ad5d0264 100755 --- a/pgo/full-headless-cage.sh +++ b/pgo/full-headless-cage.sh @@ -1,6 +1,6 @@ #!/bin/sh -set -eu +set -eux srcdir=$(realpath "${1}") blddir=$(realpath "${2}") diff --git a/pgo/full-headless-sway-inner.sh b/pgo/full-headless-sway-inner.sh index 5bf20390..dd612a2a 100755 --- a/pgo/full-headless-sway-inner.sh +++ b/pgo/full-headless-sway-inner.sh @@ -1,6 +1,6 @@ #!/bin/sh -set -u +set -ux srcdir=$(realpath "${1}") blddir=$(realpath "${2}") diff --git a/pgo/full-headless-sway.sh b/pgo/full-headless-sway.sh index ef34c560..bbf038b9 100755 --- a/pgo/full-headless-sway.sh +++ b/pgo/full-headless-sway.sh @@ -1,6 +1,6 @@ #!/bin/sh -set -eu +set -eux srcdir=$(realpath "${1}") blddir=$(realpath "${2}") diff --git a/pgo/full-inner.sh b/pgo/full-inner.sh index 2125885d..37cb2fb6 100755 --- a/pgo/full-inner.sh +++ b/pgo/full-inner.sh @@ -1,6 +1,6 @@ #!/bin/sh -set -eu +set -eux srcdir=$(realpath "${1}") blddir=$(realpath "${2}") @@ -20,7 +20,7 @@ LC_CTYPE=en_US.UTF-8 "${blddir}"/foot \ --config=/dev/null \ --term=xterm \ sh -c " - set -eu + set -eux '${srcdir}/scripts/generate-alt-random-writes.py' \ ${script_options} \"${pgo_data}\" diff --git a/pgo/partial.sh b/pgo/partial.sh index 9cb8bd59..c16de324 100755 --- a/pgo/partial.sh +++ b/pgo/partial.sh @@ -1,6 +1,6 @@ #!/bin/sh -set -eu +set -eux srcdir=$(realpath "${1}") blddir=$(realpath "${2}") diff --git a/pgo/pgo.sh b/pgo/pgo.sh index 56db6684..7d842036 100755 --- a/pgo/pgo.sh +++ b/pgo/pgo.sh @@ -1,6 +1,6 @@ #!/bin/sh -set -eu +set -eux usage_and_die() { echo "Usage: ${0} none|partial|full-current-session|full-headless-sway|full-headless-cage|[auto] [meson options]" -- cgit v1.3