mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-02 06:05:53 +00:00
This patch adds the following logic to the release build: pgo/profiles/profile.profdata.xz is the default profile file, compressed. This file is stored in version control using git LFS. A ninja rule is added which creates build/profile.profdata by decompressing it. If no profile file is explicitly specified, ./configure.py checks whether the compressed default profile file exists and is compressed. (If it exists, but isn't compressed, the user most likely has git lfs disabled or not installed. In this case, the file visible in the working tree will be the LFS placeholder text file describing the LFS metadata.) If the compressed file exists, build/profile.profdata is chosen as the used profile file. If it doesn't exist, a warning is printed and configure.py falls back to a profileless build. The default profile file can be explicitly disabled by passing the empty --use-profile="" to configure.py A script is added which re-generates the profile. After the script is run, the re-generated compressed profile can be staged, committed, pushed and merged to update the default profile.
32 lines
1.0 KiB
Bash
Executable File
32 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Copyright (C) 2023-present ScyllaDB
|
|
#
|
|
#
|
|
# SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
|
|
#
|
|
|
|
set -eu
|
|
|
|
SCRIPT_PATH="$(realpath "$0")"
|
|
PROJECT_BASE="$(realpath "$(dirname "$0")"/..)"
|
|
WORKING_DIR="$(realpath "$PWD")"
|
|
if [ "$PROJECT_BASE" != "$WORKING_DIR" ]; then
|
|
echo "Error: $SCRIPT_PATH should be ran with $PROJECT_BASE instead of $WORKING_DIR as the working directory" >&2
|
|
exit 1
|
|
fi
|
|
|
|
BUILD_PATH=build/release-cs-pgo/profiles/merged.profdata
|
|
TARGET_PATH=pgo/profiles/$(uname -m)/profile.profdata.xz
|
|
./configure.py --mode=release --pgo --cspgo --use-profile=
|
|
|
|
# ninja "$BUILD_PATH" would avoid a build step, but let's do it voluntarily
|
|
# to check that the profile doesn't cause any compilation problems.
|
|
ninja build/release/scylla
|
|
|
|
# Profiles are stored in version control, so we want very strong compression.
|
|
mkdir -p "$(dirname "$TARGET_PATH")"
|
|
xz --compress -9 --stdout "$BUILD_PATH" >"$TARGET_PATH"
|
|
|
|
echo "Profile $TARGET_PATH regenerated. You can now stage, commit, and push it."
|