Skip to content

Commit 4a83c90

Browse files
committed
ci: add macOS walltime job running fib benchmark for flamegraph testing
1 parent 5c24886 commit 4a83c90

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ jobs:
6464
runner: "ubuntu-latest"
6565
- codspeed-mode: "walltime"
6666
runner: "codspeed-macro"
67+
- codspeed-mode: "walltime"
68+
runner: "macos-latest"
69+
benchmark-filter: "BM_FibonacciRecursive_Darwin"
6770
- codspeed-mode: "off"
6871
runner: "ubuntu-latest"
6972
runs-on: ${{ matrix.runner }}
@@ -93,7 +96,7 @@ jobs:
9396
if: matrix.codspeed-mode != 'off'
9497
with:
9598
mode: ${{ matrix.codspeed-mode }}
96-
run: examples/google_benchmark_cmake/build/benchmark_example
99+
run: examples/google_benchmark_cmake/build/benchmark_example --benchmark_filter=${{ matrix.benchmark-filter || '.*' }}
97100

98101
bazel-integration-tests:
99102
strategy:

examples/google_benchmark_cmake/fibonacci_bench.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@ static void BM_FibonacciRecursive(benchmark::State& state) {
1616
}
1717
BENCHMARK(BM_FibonacciRecursive)->Arg(35)->MinTime(5);
1818

19+
#ifdef __APPLE__
20+
static void BM_FibonacciRecursive_Darwin(benchmark::State& state) {
21+
int n = static_cast<int>(state.range(0));
22+
for (auto _ : state) {
23+
uint64_t result = fibonacci_recursive(n);
24+
benchmark::DoNotOptimize(result);
25+
}
26+
}
27+
BENCHMARK(BM_FibonacciRecursive_Darwin)->Arg(35)->MinTime(5);
28+
#endif
29+
1930
static uint64_t fibonacci_iterative(int n) {
2031
if (n <= 1) return n;
2132

0 commit comments

Comments
 (0)