diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 95fc828..af09a5b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -224,10 +224,8 @@ jobs: - name: Run the benchmarks uses: CodSpeedHQ/action@main - env: - CODSPEED_SKIP_UPLOAD: "true" with: - run: examples/google_benchmark_cmake/build/benchmark_example --benchmark_filter=Fibo + run: examples/google_benchmark_cmake/build/benchmark_example --benchmark_filter=BM_FibonacciRecursive_Darwin mode: walltime # TODO: Remove this once the runner has been released with macos support runner-version: branch:main @@ -252,14 +250,13 @@ jobs: - name: Run the benchmarks uses: CodSpeedHQ/action@main - env: - CODSPEED_SKIP_UPLOAD: "true" with: # Note: using bazel run directly fails with a permission error on `/var/tmp/_bazel_codspeed/` # This is because bazel does not like the user switch between running `bazel build` as a user then running `bazel run` as sudo and refuses to run. # For now, `$USER` remains the original user, but the program is ran with uid 0 with `sudo --preserve-env` # This problem is temporary because the runner does not YET do the same uid/gid spoofing on macos as it does on linux. - run: ./bazel-bin/examples/google_benchmark_bazel/my_benchmark --benchmark_filter=Fibo + # + # BUILD_WORKSPACE_DIRECTORY is normally set by `bazel run`; we set it manually so workspace-relative __FILE__ resolution works when invoking the binary directly. + run: BUILD_WORKSPACE_DIRECTORY=$PWD ./bazel-bin/examples/google_benchmark_bazel/my_benchmark --benchmark_filter=BM_FibonacciRecursive_Darwin mode: walltime - # TODO: Remove this once the runner has been released with macos support runner-version: branch:main diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index cca86a8..669eabb 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -15,7 +15,7 @@ include(FetchContent) FetchContent_Declare( instrument_hooks_repo GIT_REPOSITORY https://github.com/CodSpeedHQ/instrument-hooks - GIT_TAG ecdf31a3afd0fb879823e40df65129ec823d374b + GIT_TAG b9ddb5bc654b2e6fa13eb18efcd3a45e7ecda0bb ) FetchContent_MakeAvailable(instrument_hooks_repo) FetchContent_GetProperties(instrument_hooks_repo) diff --git a/core/instrument-hooks b/core/instrument-hooks index ecdf31a..b9ddb5b 160000 --- a/core/instrument-hooks +++ b/core/instrument-hooks @@ -1 +1 @@ -Subproject commit ecdf31a3afd0fb879823e40df65129ec823d374b +Subproject commit b9ddb5bc654b2e6fa13eb18efcd3a45e7ecda0bb diff --git a/examples/google_benchmark_cmake/fibonacci_bench.hpp b/examples/google_benchmark_cmake/fibonacci_bench.hpp index 6c7a677..ac12cf1 100644 --- a/examples/google_benchmark_cmake/fibonacci_bench.hpp +++ b/examples/google_benchmark_cmake/fibonacci_bench.hpp @@ -16,6 +16,18 @@ static void BM_FibonacciRecursive(benchmark::State& state) { } BENCHMARK(BM_FibonacciRecursive)->Arg(35)->MinTime(5); +#ifdef __APPLE__ +// TODO(COD-2715): Run all benches on MacOS +static void BM_FibonacciRecursive_Darwin(benchmark::State& state) { + int n = static_cast(state.range(0)); + for (auto _ : state) { + uint64_t result = fibonacci_recursive(n); + benchmark::DoNotOptimize(result); + } +} +BENCHMARK(BM_FibonacciRecursive_Darwin)->Arg(35)->MinTime(5); +#endif + static uint64_t fibonacci_iterative(int n) { if (n <= 1) return n;