Skip to content

Add a benchmark which uses Google benchmark library #14

Add a benchmark which uses Google benchmark library

Add a benchmark which uses Google benchmark library #14

Workflow file for this run

name: Benchmark
on:
pull_request:
branches: ["dev"]
push:
branches: ["master"]
env:
BUILD_DIR: Dist
CCACHE_DIR: ${{ github.workspace }}/.ccache
permissions:
contents: read
jobs:
benchmark:
runs-on: ubuntu-latest
container: seladb/ubuntu2204
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
# Checkout is performed out of the container and doesn't match our user
- name: Fix checkout ownership
run: chown -R "$(id -u):$(id -g)" "$GITHUB_WORKSPACE"
- name: Restore Ccache
id: ccache-restore
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: |
${{ env.CCACHE_DIR }}
key: ubuntu2204-ccache-${{ github.run_id }}
restore-keys: |
ubuntu2204-ccache
- name: Install dependencies (remove and install this to the container)
run: apt-get update && apt-get install -y libbenchmark-dev
- name: Configure PcapPlusPlus for benchmarking
run: cmake -DPCAPPP_BUILD_BENCHMARK_SUITE=ON -S . -B "$BUILD_DIR"
- name: Build PcapPlusPlus
run: cmake --build "$BUILD_DIR" -j
- name: Run PcapPlusPlus benchmark
run: cd Benchmarks && ./Bin/PcppBenchmark --benchmark_out=benchmark_result.json
- name: Save Ccache
uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ steps.ccache-restore.outputs.cache-primary-key }}