Skip to content

Instantly share code, notes, and snippets.

@kdmukai
Created January 9, 2025 15:10
Show Gist options
  • Save kdmukai/b82f74bf5ff4f84c60e98f999968c189 to your computer and use it in GitHub Desktop.
Save kdmukai/b82f74bf5ff4f84c60e98f999968c189 to your computer and use it in GitHub Desktop.

Revisions

  1. kdmukai created this gist Jan 9, 2025.
    25 changes: 25 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    These test scripts demonstrate the step-by-step speed ups that the various `ccache`s provide.

    Scripted test sequence:
    * Start a build w/totally empty cache(s).
    * Rebuild the same target with the now populated cache(s).
    * Change to a new target and get some speedup via the populated cache(s).
    * Rebuild that target to get the full speedup.
    * ...repeat for the remaining two targets.

    The first script is for a SeedSigner OS builder that only has the built-in BuildRoot `ccache`.

    The second script is for a SeedSigner OS builder with the new additional "external" `ccache`.

    ---

    To run these in the Docker container, you'll need to first add:
    ```bash
    # Need the version of `time` that can write to a file
    apt install time
    ```

    And when running the first script in a SeedSigner OS Docker image that only has the BuildRoot internal ccache, you'll need to explictly add `ccache` to get the cache clearing and stat reporting:
    ```bash
    apt install ccache
    ```
    19 changes: 19 additions & 0 deletions run_sequence_1.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    #!/bin/bash

    # Test on a SeedSigner OS version that only has the BuildRoot ccache.
    # Tests BR ccache's performance during a build sequence, starting from an empty cache.

    touch results.txt
    ccache -d /root/.buildroot-ccache -C
    for device in pi0 pi0 pi02w pi02w pi2 pi2 pi4 pi4
    do
    ccache -d /root/.buildroot-ccache --zero-stats
    echo "Building for: $device w/ongoing BR ccache" >> results.txt
    /usr/bin/time -o results.txt -a ./build.sh --$device --app-repo=https://github.com/seedsigner/seedsigner.git --app-branch=0.8.5-rc1
    echo "---------------------------------------------------" >> results.txt
    ccache -d /root/.buildroot-ccache --show-stats >> results.txt
    echo "---------------------------------------------------" >> results.txt
    echo " " >> results.txt
    done

    cat results.txt
    23 changes: 23 additions & 0 deletions run_sequence_2.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    #!/bin/bash

    # Test on a SeedSigner OS version that has the BuildRoot ccache AND the new "external" ccache.
    # Tests the combined ccache performance during a build sequence, starting from empty caches.

    touch results.txt
    ccache -d /root/.buildroot-ccache -C
    ccache -C
    for device in pi0 pi0 pi02w pi02w pi2 pi2 pi4 pi4
    do
    ccache -d /root/.buildroot-ccache --zero-stats
    ccache --zero-stats
    echo "Building for: $device w/ongoing BR & external ccaches" >> results.txt
    /usr/bin/time -o results.txt -a ./build.sh --$device --app-repo=https://github.com/seedsigner/seedsigner.git --app-branch=0.8.5-rc1
    echo "---------------------------------------------------" >> results.txt
    ccache -d /root/.buildroot-ccache --show-stats >> results.txt
    echo "---------------------------------------------------" >> results.txt
    ccache --show-stats >> results.txt
    echo "---------------------------------------------------" >> results.txt
    echo " " >> results.txt
    done

    cat results.txt