-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Post numbers from a few benchmarks to bencher (#6207)
- Loading branch information
Showing
6 changed files
with
118 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: "Continous Benchmarking" | ||
|
||
on: | ||
push: | ||
branches: main | ||
|
||
jobs: | ||
benchmark_base_branch: | ||
name: Continuous Benchmarking with Bencher | ||
runs-on: [self-hosted, 1ES.Pool=gha-virtual-ccf-sub] | ||
container: | ||
image: ccfmsrc.azurecr.io/ccf/ci:2024-04-25-virtual-clang15 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- run: | | ||
git config --global --add safe.directory /__w/CCF/CCF | ||
mkdir build | ||
cd build | ||
cmake -GNinja -DCOMPILE_TARGET=virtual .. | ||
ninja | ||
# Limited list of benchmarks for now, but should be extended to | ||
# everything under a single label eventually | ||
./tests.sh -VV -R pi_basic_virtual | ||
./tests.sh -VV -R historical_query | ||
./tests.sh -VV -R commit_latency | ||
- uses: bencherdev/bencher@main | ||
- name: Track base branch benchmarks with Bencher | ||
run: | | ||
bencher run \ | ||
--project ccf \ | ||
--token '${{ secrets.BENCHER_API_TOKEN }}' \ | ||
--branch main \ | ||
--testbed gha-virtual-ccf-sub \ | ||
--adapter json \ | ||
--err \ | ||
--file build/bencher.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the Apache 2.0 License. | ||
|
||
import os | ||
import json | ||
import dataclasses | ||
from typing import Optional, Union | ||
|
||
BENCHER_FILE = "bencher.json" | ||
|
||
# See https://bencher.dev/docs/reference/bencher-metric-format/ | ||
|
||
|
||
@dataclasses.dataclass | ||
class Value: | ||
value: float | ||
high_value: Optional[float] = None | ||
low_value: Optional[float] = None | ||
|
||
|
||
@dataclasses.dataclass | ||
class Latency: | ||
latency: Value | ||
|
||
def __init__( | ||
self, | ||
value: float, | ||
high_value: Optional[float] = None, | ||
low_value: Optional[float] = None, | ||
): | ||
self.latency = Value(value, high_value, low_value) | ||
|
||
|
||
@dataclasses.dataclass | ||
class Throughput: | ||
throughput: Value | ||
|
||
def __init__( | ||
self, | ||
value: float, | ||
high_value: Optional[float] = None, | ||
low_value: Optional[float] = None, | ||
): | ||
self.throughput = Value(value, high_value, low_value) | ||
|
||
|
||
class Bencher: | ||
def __init__(self): | ||
if not os.path.isfile(BENCHER_FILE): | ||
with open(BENCHER_FILE, "w+") as bf: | ||
json.dump({}, bf) | ||
|
||
def set(self, key: str, value: Union[Latency, Throughput]): | ||
with open(BENCHER_FILE, "r") as bf: | ||
data = json.load(bf) | ||
data[key] = dataclasses.asdict(value) | ||
with open(BENCHER_FILE, "w") as bf: | ||
json.dump(data, bf, indent=4) |