Skip to content

Commit 9ee94d8

Browse files
authored
bench: criterion harness and guardrail crate (c4) (#84)
* bench: add criterion harness and guardrail crate Create the dedicated benchmark phase by adding benchmark_support, the up-streamer criterion bench harness, and a standalone criterion-guardrail crate with fixture-backed threshold checks, plus workflow/script plumbing. This boundary isolates performance tooling and benchmark-only wiring from smoke-suite and endpoint-behavior changes so reviewers can validate ergonomics guardrails independently. Key review files: up-streamer/src/benchmark_support.rs, up-streamer/benches/streamer_criterion.rs, utils/criterion-guardrail/src/lib.rs, scripts/bench_streamer_criterion.sh, .github/workflows/benchmark-guardrail-advisory.yaml, up-streamer/Cargo.toml, Cargo.toml. Mechanical vs behavioral: mostly mechanical benchmark wiring and fixture ingestion with behavioral logic constrained to deterministic threshold evaluation in the guardrail crate. * refactor: apply up-rust feedback sweep to benchmark delta
1 parent cc71917 commit 9ee94d8

25 files changed

Lines changed: 1695 additions & 4 deletions

File tree

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# ********************************************************************************
2+
# Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************/
13+
14+
name: Benchmark Guardrail Advisory
15+
16+
on:
17+
pull_request:
18+
paths:
19+
- ".github/workflows/benchmark-guardrail-advisory.yaml"
20+
- "up-streamer/**"
21+
- "utils/criterion-guardrail/**"
22+
- "scripts/bench_streamer_criterion.sh"
23+
workflow_dispatch:
24+
25+
jobs:
26+
criterion_guardrail_advisory:
27+
name: Criterion Guardrail Advisory
28+
runs-on: ubuntu-22.04
29+
30+
steps:
31+
- uses: actions/checkout@v4
32+
- uses: dtolnay/rust-toolchain@stable
33+
34+
- name: Add execute permissions for scripts
35+
run: chmod +x build/envsetup.sh scripts/bench_streamer_criterion.sh
36+
37+
- name: Benchmark baseline and candidate
38+
shell: bash
39+
run: |
40+
source build/envsetup.sh highest
41+
export CRITERION_ARGS="--sample-size 60 --warm-up-time 3 --measurement-time 12 --noise-threshold 0.02"
42+
if command -v taskset >/dev/null; then export BENCH_PIN_PREFIX="taskset -c 2"; else export BENCH_PIN_PREFIX=""; fi
43+
scripts/bench_streamer_criterion.sh baseline
44+
scripts/bench_streamer_criterion.sh candidate ci_candidate
45+
46+
- name: Run criterion-guardrail (advisory)
47+
continue-on-error: true
48+
run: |
49+
scripts/bench_streamer_criterion.sh guardrail ci_candidate "$GITHUB_WORKSPACE/target/criterion/ci-guardrail.json"
50+
51+
- name: Export bencher compare output (advisory)
52+
continue-on-error: true
53+
shell: bash
54+
run: |
55+
export OPENCODE_CONFIG_DIR="$GITHUB_WORKSPACE/target/criterion-artifacts"
56+
scripts/bench_streamer_criterion.sh export
57+
58+
- name: Upload criterion guardrail artifacts
59+
if: ${{ always() }}
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: criterion-guardrail-advisory
63+
if-no-files-found: warn
64+
path: |
65+
target/criterion/ci-guardrail.json
66+
target/criterion-artifacts/reports/ergonomics-perf/bench-data/criterion-compare-bencher.txt

Cargo.lock

Lines changed: 172 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ members = [
1616
"utils/hello-world-protos",
1717
"utils/integration-test-utils",
1818
"example-streamer-implementations",
19+
"utils/criterion-guardrail",
1920
"configurable-streamer",
2021
"up-linux-streamer-plugin",
2122
"up-streamer",

0 commit comments

Comments
 (0)