1
0
Fork 0
dosbox-staging/.github/scripts/fetch-and-merge-afdo.sh
krcroft 78ae277d28 Expand use and support for LTO and FDO builds
Adds LTO to the CI build for Linux, which bring it as close as possible
to the planned formal release, which will additionally use FDO.

Adds some helper scripts to work with FDO files.

Improves the build notes for how to create and use FDO files.
2020-04-01 08:03:39 +02:00

30 lines
935 B
Bash
Executable file

#!/bin/bash
# Copyright (c) 2019-2020 Kevin R Croft <krcroft@gmail.com>
# SPDX-License-Identifier: GPL-2.0-or-later
# A helper script that fetches, converts, and merges kernel sample
# (.prof) files (collected during prior DOSBox testing) into a single
# GCC-compatible AutoFDO record that can be used to optimize builds.
# Depedencies:
# - zstd
# - autofdo
set -euo pipefail
# Tarball containing profile records
PROFILES="https://gitlab.com/luxtorpeda/dosbox-tests/-/raw/master/archives/profiles.tar.zst"
BINARY="tests/dosbox"
# Move to our repo root
cd "$(git rev-parse --show-toplevel)"
# Fetch and unpack the profiles
wget "${PROFILES}" -O - | zstd -d | tar -x
# Convert and merge the profiles
find . -name '*.prof' -print0 \
| xargs -0 -P "$(nproc)" -I {} \
create_gcov --binary="${BINARY}" --profile="{}" -gcov="{}".afdo -gcov_version=1
profile_merger -gcov_version=1 -output_file=current.afdo tests/*/*.afdo