Skip to content

feat(bench): add latency benchmarks #225

feat(bench): add latency benchmarks

feat(bench): add latency benchmarks #225

Workflow file for this run

name: CI
on:
push:
branches: [ main, stable ]
pull_request:
branches: [ main ]
jobs:
linux:
runs-on: ubuntu-latest
strategy:
matrix:
std: [11, 17]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- run: git submodule update --init --recursive
- name: Configure
run: cmake -S . -B build -DLOGIT_CPP_BUILD_TESTS=ON -DCMAKE_CXX_STANDARD=${{ matrix.std }} -DLOGIT_WITH_SYSLOG=ON -DLOGIT_WITH_WIN_EVENT_LOG=OFF
- name: Build
run: cmake --build build
- name: Install
run: cmake --install build --prefix install
- name: Test
run: ctest --test-dir build --output-on-failure
- name: Configure benchmarks
if: ${{ github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/stable') }}
run: cmake -S . -B build-bench -DLOGIT_BENCH_ENABLE=ON -DLOGIT_BENCH_WITH_SPDLOG=ON -DCMAKE_CXX_STANDARD=${{ matrix.std }} -DLOGIT_WITH_SYSLOG=ON -DLOGIT_WITH_WIN_EVENT_LOG=OFF
- name: Build benchmarks
if: ${{ github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/stable') }}
run: cmake --build build-bench --target logit_bench
- name: Run latency benchmarks
if: ${{ github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/stable') }}
timeout-minutes: 20
env:
LOGIT_BENCH_TIMEOUT_SEC: 900
LOGIT_BENCH_TOTAL: 20000
LOGIT_BENCH_WARMUP: 2000
run: ./build-bench/logit_bench
- name: Configure consumer project
run: cmake -S tests/install_consumer -B build-consumer -DCMAKE_PREFIX_PATH=${{ github.workspace }}/install -DCMAKE_CXX_STANDARD=${{ matrix.std }}
- name: Build consumer project
run: cmake --build build-consumer
- name: Upload logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: logs-${{ matrix.std }}
path: |
build/CMakeFiles/CMakeOutput.log
build/Testing/Temporary/LastTest.log
if-no-files-found: ignore
windows:
runs-on: windows-latest
strategy:
matrix:
std: [11, 17]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- run: git submodule update --init --recursive
- name: Configure
run: cmake -S . -B build -DLOGIT_CPP_BUILD_TESTS=ON -DCMAKE_CXX_STANDARD=${{ matrix.std }} -DLOGIT_WITH_SYSLOG=OFF -DLOGIT_WITH_WIN_EVENT_LOG=ON
- name: Build
run: cmake --build build --config Release
- name: Install
run: cmake --install build --prefix install --config Release
- name: Test
run: ctest --test-dir build -C Release
- name: Configure consumer project
run: cmake -S tests/install_consumer -B build-consumer -DCMAKE_PREFIX_PATH="${{ github.workspace }}/install" -DCMAKE_CXX_STANDARD=${{ matrix.std }}
- name: Build consumer project
run: cmake --build build-consumer --config Release
- name: Upload logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: logs-${{ matrix.std }}
path: |
build/CMakeFiles/CMakeOutput.log
build/Testing/Temporary/LastTest.log
if-no-files-found: ignore
macos:
runs-on: macos-latest
strategy:
matrix:
std: [11, 17]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- run: git submodule update --init --recursive
- name: Configure
run: cmake -S . -B build -DLOGIT_CPP_BUILD_TESTS=ON -DCMAKE_CXX_STANDARD=${{ matrix.std }} -DLOGIT_WITH_SYSLOG=ON -DLOGIT_WITH_WIN_EVENT_LOG=OFF
- name: Build
run: cmake --build build
- name: Install
run: cmake --install build --prefix install
- name: Test
run: ctest --test-dir build
- name: Configure consumer project
run: cmake -S tests/install_consumer -B build-consumer -DCMAKE_PREFIX_PATH=${{ github.workspace }}/install -DCMAKE_CXX_STANDARD=${{ matrix.std }}
- name: Build consumer project
run: cmake --build build-consumer
- name: Upload logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: logs-${{ matrix.std }}
path: |
build/CMakeFiles/CMakeOutput.log
build/Testing/Temporary/LastTest.log
if-no-files-found: ignore
asan-ubsan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- run: git submodule update --init --recursive
- name: Configure
run: cmake -S . -B build -DLOGIT_CPP_BUILD_TESTS=ON -DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_FLAGS='-fsanitize=address,undefined' -DCMAKE_LINKER_FLAGS='-fsanitize=address,undefined'
- name: Build
run: cmake --build build
- name: Test
run: ctest --test-dir build --output-on-failure
tsan:
runs-on: ubuntu-latest
env:
LOGIT_PROFILE: thread
steps:
- uses: actions/checkout@v4
with:
submodules: true
- run: git submodule update --init --recursive
- name: Configure
run: cmake -S . -B build -DLOGIT_CPP_BUILD_TESTS=ON -DLOGIT_FORCE_ASYNC_OFF=OFF -DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_FLAGS='-fsanitize=thread' -DCMAKE_LINKER_FLAGS='-fsanitize=thread'
- name: Build
run: cmake --build build
- name: Test
run: ctest --test-dir build --output-on-failure
vcpkg-install:
runs-on: ubuntu-latest
env:
VCPKG_TAG: '2024.09.30'
steps:
- uses: actions/checkout@v4
with:
submodules: true
- run: git submodule update --init --recursive
- name: Restore vcpkg cache
id: cache-vcpkg
uses: actions/cache/restore@v3
with:
path: |
vcpkg
vcpkg/downloads
vcpkg/installed
key: ${{ runner.os }}-vcpkg-${{ env.VCPKG_TAG }}-${{ hashFiles('vcpkg-overlay/ports/**', 'libs/time-shield-cpp/vcpkg-overlay/ports/**') }}
- name: Install vcpkg
if: steps.cache-vcpkg.outputs.cache-hit != 'true'
run: |
git clone https://github.com/microsoft/vcpkg.git --branch $VCPKG_TAG --single-branch
./vcpkg/bootstrap-vcpkg.sh -disableMetrics
- name: Validate port
run: |
./vcpkg/vcpkg install log-it-cpp \
--overlay-ports=vcpkg-overlay/ports \
--overlay-ports=libs/time-shield-cpp/vcpkg-overlay/ports
- name: Configure consumer project
run: cmake -B build -S tests/install_consumer -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Build consumer project
run: cmake --build build
- name: Save vcpkg cache
if: success() && steps.cache-vcpkg.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: |
vcpkg
vcpkg/downloads
vcpkg/installed
key: ${{ runner.os }}-vcpkg-${{ env.VCPKG_TAG }}-${{ hashFiles('vcpkg-overlay/ports/**', 'libs/time-shield-cpp/vcpkg-overlay/ports/**') }}
- name: Upload logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: vcpkg-install-logs
path: |
build/CMakeFiles/CMakeOutput.log
build/Testing/Temporary/LastTest.log
if-no-files-found: ignore
emscripten:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- run: git submodule update --init --recursive
- uses: mymindstorm/setup-emsdk@v14
with:
version: 'latest'
- name: Configure (Node target)
run: |
emcmake cmake -S . -B build-ems \
-DCMAKE_BUILD_TYPE=Release \
-DLOGIT_CPP_BUILD_TESTS=ON \
-DLOGIT_EMSCRIPTEN=ON -DLOGIT_FORCE_ASYNC_OFF=ON
- name: Build
run: cmake --build build-ems --target ems_console ems_async_flush -j
- name: Run smoke tests
run: |
node --no-experimental-fetch build-ems/tests/ems_console.js
node --no-experimental-fetch build-ems/tests/ems_async_flush.js
- name: Upload logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: emscripten-logs
path: |
build-ems/CMakeFiles/CMakeOutput.log
build-ems/Testing/Temporary/LastTest.log
if-no-files-found: ignore