Skip to content

bench

bench #620

Workflow file for this run

name: bench
on:
# push:
# branches:
# - main
workflow_dispatch:
inputs:
index:
description: 'Benchmark index'
required: false
default: 'default'
selector:
description: 'Benchmark selector'
required: false
default: 'Kyo'
warmupIterations:
description: 'Warmup iterations'
required: false
default: '10'
measurementIterations:
description: 'Measurement iterations'
required: false
default: '4'
iterationTime:
description: 'Iteration time'
required: false
default: '1'
forks:
description: 'Number of forks'
required: false
default: '1'
threads:
description: 'Number of threads'
required: false
default: '1'
profileEvents:
description: 'Profile events'
required: false
default: 'alloc,cpu'
jobs:
bench:
name: bench
runs-on: bench
timeout-minutes: 240
env:
IX: ${{ github.event.inputs.index || 'default' }}
SE: ${{ github.event.inputs.selector || 'Kyo' }}
WI: ${{ github.event.inputs.warmupIterations || '13' }}
MI: ${{ github.event.inputs.measurementIterations || '5' }}
IT: ${{ github.event.inputs.iterationTime || '1' }}
FK: ${{ github.event.inputs.forks || '1' }}
TH: ${{ github.event.inputs.threads || '1' }}
PE: ${{ github.event.inputs.profileEvents || 'alloc,cpu' }}
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- uses: olafurpg/setup-scala@v13
with:
java-version: [email protected]=tgz+https://download.java.net/java/GA/jdk21.0.2/f2283984656d49d69e91c558476027ac/13/GPL/openjdk-21.0.2_linux-x64_bin.tar.gz
- name: install async-profiler
run: |
cd /home/runner
wget https://github.com/jvm-profiling-tools/async-profiler/releases/download/v2.9/async-profiler-2.9-linux-x64.tar.gz
tar -xvzf async-profiler-2.9-linux-x64.tar.gz
sudo mkdir -p /usr/java/packages/lib/
sudo cp async-profiler-2.9-linux-x64/build/libasyncProfiler.so /usr/java/packages/lib/
sudo sysctl kernel.perf_event_paranoid=1
sudo sysctl kernel.kptr_restrict=0
- name: run
run: |
IFS=', ' read -r -a array <<< "$PE"
for EVENT in "${array[@]}"
do
ESCAPED_EVENT=$(printf '%q' "$EVENT")
sbt "kyo-bench/jmh:clean;kyo-bench/jmh:run -wi $WI -i $MI -r $IT -w $IT -f $FK -t $TH -foe true -prof \"async:event=$ESCAPED_EVENT;output=flamegraph\" $SE"
done
sbt "kyo-bench/jmh:clean;kyo-bench/jmh:run -wi $WI -i $MI -r $IT -w $IT -f $FK -t $TH -foe true -prof gc -rf json $SE"
- name: prepare results
run: |
short_sha=$(echo "${{ github.sha }}" | cut -c 1-7)
mkdir -p output/
cp -r kyo-bench/.jvm/jmh-result.json output/#${short_sha}-jmh-result.json
cp -r kyo-bench/.jvm/kyo.bench.* output/
rm -rf output/**/*reverse.html
for file in $(find output -name "*.html"); do
newfile=$(echo $file | sed 's/\([^.]*\)-.*flame-\([^-]*\)-forward.html/\1-\2.html/')
if [ "$file" != "$newfile" ]; then
mv "$file" "$newfile"
fi
done
for file in $(find output -name "*.html"); do
new_name="${short_sha}-$(basename "$file")"
mv "$file" "$(dirname "$file")/$new_name"
done
ls output/
- name: publish results
id: publish-results
uses: actions/github-script@v5
with:
github-token: ${{ secrets.GIST_PAT }}
script: |
const fs = require('fs').promises;
const path = require('path');
// Create release tag
const short_sha = context.sha.substring(0, 7);
const tag = `bench-${short_sha}`;
const date = new Date().toISOString().split('T')[0];
// Create the release
const release = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: tag,
name: `Benchmark Results ${short_sha} ${date}`,
body: `Benchmark results for commit ${context.sha} on ${date}`,
prerelease: true // Mark as prerelease to separate from regular releases
});
// Upload all files from output directory
const files = await fs.readdir('output');
for (const file of files) {
const filePath = path.join('output', file);
const content = await fs.readFile(filePath);
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.data.id,
name: file,
data: content,
headers: {
'content-type': 'application/octet-stream',
'content-length': content.length
}
});
}