Skip to content

Commit d950b52

Browse files
authored
Merge pull request #1726 from CarlWachter/feat/cb
ci: add continuous benchmarking
2 parents 7fa981b + 3e3807c commit d950b52

File tree

3 files changed

+184
-0
lines changed

3 files changed

+184
-0
lines changed

.github/benchmarks/general.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
- group: General
2+
plot_group: Startup Time
3+
name: 1 core
4+
bin: startup_benchmark
5+
hermit_rs_manifest_path: benches/startup/Cargo.toml
6+
command: |
7+
sudo qemu-system-x86_64 \
8+
-enable-kvm \
9+
-cpu host,migratable=no,+invtsc \
10+
-smp 1 \
11+
-m 128M \
12+
-display none \
13+
-serial stdio \
14+
-kernel hermit-loader-x86_64 \
15+
-initrd target/x86_64-unknown-hermit/release/startup_benchmark
16+
iterations: 25
17+
external_time: true
18+
19+
- group: General
20+
plot_group: Startup Time
21+
name: 2 cores
22+
bin: startup_benchmark
23+
hermit_rs_manifest_path: benches/startup/Cargo.toml
24+
command: |
25+
sudo qemu-system-x86_64 \
26+
-enable-kvm \
27+
-cpu host,migratable=no,+invtsc \
28+
-smp 2 \
29+
-m 128M \
30+
-display none \
31+
-serial stdio \
32+
-kernel hermit-loader-x86_64 \
33+
-initrd target/x86_64-unknown-hermit/release/startup_benchmark
34+
iterations: 25
35+
external_time: true
36+
37+
- group: General
38+
plot_group: Startup Time
39+
name: 4 cores
40+
bin: startup_benchmark
41+
hermit_rs_manifest_path: benches/startup/Cargo.toml
42+
command: |
43+
sudo qemu-system-x86_64 \
44+
-enable-kvm \
45+
-cpu host,migratable=no,+invtsc \
46+
-smp 4 \
47+
-m 128M \
48+
-display none \
49+
-serial stdio \
50+
-kernel hermit-loader-x86_64 \
51+
-initrd target/x86_64-unknown-hermit/release/startup_benchmark
52+
iterations: 25
53+
external_time: true
54+
55+
- group: General
56+
plot_group: Multithreaded Pi Efficiency
57+
name: Pi Multithreaded Benchmark
58+
bin: multithreaded_benchmark
59+
hermit_rs_manifest_path: benches/multithreaded/Cargo.toml
60+
command: |
61+
sudo qemu-system-x86_64 \
62+
-enable-kvm \
63+
-cpu host,migratable=no,+invtsc \
64+
-smp 4 \
65+
-m 512M \
66+
-display none \
67+
-serial stdio \
68+
-kernel hermit-loader-x86_64 \
69+
-initrd target/x86_64-unknown-hermit/release/multithreaded_benchmark
70+
iterations: 25
71+
external_time: false

.github/benchmarks/misc.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
- group: Micro
2+
name: Micro Benchmarks
3+
bin: micro_benchmarks
4+
hermit_rs_manifest_path: benches/micro/Cargo.toml
5+
command: |
6+
sudo qemu-system-x86_64 \
7+
-enable-kvm \
8+
-cpu host,migratable=no,+invtsc \
9+
-smp 4 \
10+
-m 512M \
11+
-display none \
12+
-serial stdio \
13+
-kernel hermit-loader-x86_64 \
14+
-initrd target/x86_64-unknown-hermit/release/micro_benchmarks
15+
iterations: 25
16+
17+
- group: Allocations
18+
name: Allocation Benchmarks
19+
bin: alloc_benchmarks
20+
hermit_rs_manifest_path: benches/alloc/Cargo.toml
21+
command: |
22+
sudo qemu-system-x86_64 \
23+
-enable-kvm \
24+
-cpu host,migratable=no,+invtsc \
25+
-smp 1 \
26+
-m 5G \
27+
-display none \
28+
-serial stdio \
29+
-kernel hermit-loader-x86_64 \
30+
-initrd target/x86_64-unknown-hermit/release/alloc_benchmarks
31+
iterations: 50
32+
33+
- group: Mutex
34+
name: Mutex Stress Test
35+
bin: mutex_benchmark
36+
hermit_rs_manifest_path: benches/mutex/Cargo.toml
37+
command: |
38+
sudo qemu-system-x86_64 \
39+
-enable-kvm \
40+
-cpu host,migratable=no,+invtsc \
41+
-smp 2 \
42+
-m 512M \
43+
-display none \
44+
-serial stdio \
45+
-kernel hermit-loader-x86_64 \
46+
-initrd target/x86_64-unknown-hermit/release/mutex_benchmark
47+
iterations: 50

.github/workflows/benchmark.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Benchmark
2+
3+
on:
4+
pull_request_target:
5+
push:
6+
branches:
7+
- main
8+
9+
env:
10+
GH_TOKEN: ${{ github.token }}
11+
12+
jobs:
13+
benchmark:
14+
name: Run Benchmarks
15+
runs-on: [self-hosted]
16+
environment: ${{ github.event_name == 'push' && 'benchmark' || '' }}
17+
18+
permissions:
19+
pull-requests: write
20+
21+
strategy:
22+
matrix:
23+
include:
24+
- benchmark-file: kernel/.github/benchmarks/general.yaml
25+
benchmark-matrix-name: General
26+
- benchmark-file: kernel/.github/benchmarks/misc.yaml
27+
benchmark-matrix-name: Misc
28+
29+
steps:
30+
- name: Checkout hermit-rs
31+
uses: actions/checkout@v4
32+
with:
33+
repository: hermit-os/hermit-rs
34+
submodules: true
35+
- name: Remove hermit-kernel submodule
36+
run: git rm -r kernel
37+
- name: Checkout hermit-kernel
38+
uses: actions/checkout@v4
39+
with:
40+
path: kernel
41+
- name: Install packages
42+
run: |
43+
sudo apt-get update
44+
sudo apt-get install -y --no-install-recommends qemu-system-x86 gh
45+
- uses: mkroening/rust-toolchain-toml@main
46+
- uses: mkroening/rust-toolchain-toml@main
47+
with:
48+
toolchain-file: "kernel/rust-toolchain.toml"
49+
- name: Download loader
50+
run: gh release download --repo hermit-os/loader --pattern hermit-loader-x86_64
51+
- name: Run benchmarks
52+
uses: hermit-os/hermit-bench@main
53+
id: run-bench
54+
with:
55+
benchmark-file: ${{ matrix.benchmark-file }}
56+
- name: Store benchmark results
57+
uses: hermit-os/github-action-benchmark@main
58+
with:
59+
tool: "hermit-bench"
60+
output-file-path: ${{ steps.run-bench.outputs.result-file }}
61+
github-token: ${{ github.event_name == 'push' && secrets.HERMIT_BENCH_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
62+
benchmark-data-dir-path: .
63+
gh-repository: github.com/hermit-os/hermit-bench
64+
comment-always: true
65+
benchmark-matrix-name: ${{ matrix.benchmark-matrix-name }}
66+
auto-push: ${{ github.event_name == 'push' }}

0 commit comments

Comments
 (0)