Skip to content

Commit

Permalink
Convience script to run benchmark
Browse files Browse the repository at this point in the history
Summary: You need to provide the benchmark binary with a path to the captures. This is annoying and there is not a great way to do this in c++ that is cross-plat. So I just made this bash script to ease it. It can do buck and cmake.

Reviewed By: NickGerleman

Differential Revision: D53632438

fbshipit-source-id: 470d4563ff33637a385b0f5c4d7fc3a023f68a96
  • Loading branch information
joevilches authored and facebook-github-bot committed Feb 13, 2024
1 parent be893b4 commit 95b790d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/validate-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,15 @@ jobs:
with:
toolchain: ${{ matrix.toolchain }}

- name: Build benchmark
- name: Build and run benchmark
run: ./benchmark
working-directory: benchmark

- name: Build and run benchmarklegacy
run: |
cmake -S . -B build -G Ninja -D CMAKE_BUILD_TYPE=Release
cmake --build build
working-directory: benchmark

- name: Run benchmarklegacy
run: ./build/benchmarklegacy
./build/benchmarklegacy
working-directory: benchmark

capture:
Expand Down
15 changes: 15 additions & 0 deletions benchmark/benchmark
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
cd "$(dirname "$0")" || exit
CAPTURES_PATH="$(dirname "$(realpath "$0")")""/captures"

if [ "$1" = "buck" ]; then
buck run @fbcode/mode/opt :benchmarkCXX "${CAPTURES_PATH}"
else
cmake -B build -S . -D CMAKE_BUILD_TYPE=Release
cmake --build build
build/benchmark "${CAPTURES_PATH}"
fi

0 comments on commit 95b790d

Please sign in to comment.