Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 12 additions & 0 deletions examples/google_benchmark_cmake/fibonacci_bench.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(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;

Expand Down
Loading