Cockatrice/.github/workflows/ccache-probe.yml
Lukas Brübach 2bf0e3f93a [CI] Measure what debug info costs a ccache entry
Throwaway diagnostic, not for merge. Adds COCKATRICE_DEBUG_INFO_LEVEL (cache
option, empty by default, so local and release builds are unchanged) and runs
the Arch debug leg and the Debian 13 release leg cold with -g0 and -g1 against a
6G bound, so the cache size of each configuration can be compared with the
1.2 GB the default flags produce.

One Arch configuration costs 1.2 GB with the default flags and a cache bigger
than that served 1058 of 1059 calls, so the per-leg bounds cannot hold a build
and evict what the next one asks for. This measures whether dropping DWARF is
what makes a whole configuration fit.
2026-11-04 12:29:41 +01:00

99 lines
3.6 KiB
YAML

---
# Throwaway diagnostic: why does master's ccache serve only ~14% of calls when a
# whole pull-request cache is restored?
#
# Result so far (run 41818008344): one Arch configuration costs 1.2 GB with the
# default flags, and a cache bigger than that serves 1058 of 1059 calls. The 700M
# bound therefore cannot hold one build, and a cache just under the working set
# evicts exactly what the next build asks for.
#
# This run measures the only lever that can make one configuration fit a bound:
# less debug info. Every leg's objects carry full DWARF (Debug uses -ggdb, and
# CrashReporting adds -g to Release whenever the SDK is on), and debug info
# dominates the compressed object.
#
# Two jobs, two cold builds each, no Actions cache, so the repository quota is
# untouched:
# -g0 no debug info at all: the lower bound of what a cache could cost
# -g1 file and line only: what a backtrace needs, and the candidate default
# `du` of each cache dir is the number to compare against 1.2 GB.
name: ccache probe
on:
push:
branches:
- ci/ccache-probe
pull_request:
branches:
- master
concurrency:
group: ${{ github.workflow }} @ ${{ github.ref_name }}
cancel-in-progress: true
jobs:
probe:
name: ${{ matrix.label }} debug info
runs-on: ubuntu-latest
timeout-minutes: 150
strategy:
fail-fast: false
matrix:
include:
# The debug leg: -ggdb on every object.
- label: Arch
name: Arch
leg: --server --debug --test --cmake-generator Ninja
run_env: ''
# The release leg that packages: CrashReporting adds -g on top of -O2.
- label: Debian 13
name: Debian13
leg: --server --release --test --cmake-generator Ninja
run_env: '-e WITH_CRASH_REPORTING=ON'
env:
NAME: ${{ matrix.name }}
CACHE: ${{ github.workspace }}/.cache/${{ matrix.name }}
# Far above any candidate working set: a cache that evicts cannot be measured.
CCACHE_BOUND: 6G
steps:
- name: "Checkout"
uses: actions/checkout@v7
- name: "Build image and record the compiler's identity"
shell: bash
run: |
source .ci/docker.sh --build
docker image inspect --format 'image id: {{.Id}}' "$IMAGE_NAME"
echo "=== compiler as ccache sees it (compiler_check = mtime hashes mtime and size)"
docker run --rm "$IMAGE_NAME" bash -c 'for c in c++ cc gcc g++; do p="$(command -v $c)"; [ -n "$p" ] && stat -c "%n size=%s mtime=%Y" "$p"; done; c++ --version | head -1'
- name: "Cold build with -g0"
shell: bash
run: |
rm -rf build
source .ci/docker.sh
export RUN_ARGS="$RUN_ARGS ${{ matrix.run_env }}"
# One cache directory per measurement: a shared one would mix the two results.
export CCACHE_DIR="$CACHE/.ccache-g0"
export RUN_ARGS="$RUN_ARGS -e PROBE_CMAKE_ARGS=-DCOCKATRICE_DEBUG_INFO_LEVEL=0"
RUN ${{ matrix.leg }} --ccache "$CCACHE_BOUND"
echo "=== cache for -g0"
du -sh "$CCACHE_DIR"
- name: "Cold build with -g1"
shell: bash
run: |
rm -rf build
source .ci/docker.sh
export RUN_ARGS="$RUN_ARGS ${{ matrix.run_env }}"
export CCACHE_DIR="$CACHE/.ccache-g1"
export RUN_ARGS="$RUN_ARGS -e PROBE_CMAKE_ARGS=-DCOCKATRICE_DEBUG_INFO_LEVEL=1"
RUN ${{ matrix.leg }} --ccache "$CCACHE_BOUND"
echo "=== cache for -g1"
du -sh "$CCACHE_DIR"
- name: "Both measurements"
shell: bash
run: |
du -sh "$CACHE"/.ccache-* | sed 's/^/ /'