Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init benchmark pr #2008

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/benchmark_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on: [pull_request]

name: benchmark pull requests
jobs:
runBenchmark:
name: run benchmark
runs-on: self-hosted
steps:
- name: checkout
uses: actions/checkout@v1
with:
submodules: recursive
- name: run flamegraph
run: bash ./scripts/flamegraph.sh ${{ github.event.pull_request.number }}
env:
RUST_LOG: error
RUST_BACKTRACE: full
GCP_ACCESS_KEY_ID: ${{ secrets.GCP_ACCESS_KEY_ID }}
GCP_SECRET_ACCESS_KEY: ${{ secrets.GCP_SECRET_ACCESS_KEY }}
- name: use criterion
uses: boa-dev/criterion-compare-action@master
env:
RUST_LOG: error
RUST_BACKTRACE: full
with:
cwd: "benchmarks"
branchName: ${{ github.base_ref }}
token: ${{ secrets.GITHUB_TOKEN }}

19 changes: 19 additions & 0 deletions scripts/flamegraph.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

ROOCH_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd .. && pwd)"

PR_NUMBER=$1

if [[ "$(uname)" != "Linux" ]]; then
echo "run flamegraph only in linux. exit"
fi

echo "PR_NUMBER $PR_NUMBER"

cmd="RUST_LOG=error cargo bench --bench bench_tx_exec -- --profile-time=10"
echo "run flamegraph with cmd: ${cmd}"
eval "$cmd"


aws s3api put-object --bucket flamegraph.rooch.network --key "$PR_NUMBER"/"bench_tx_exec.svg" --body $ROOCH_DIR/target/criterion/bench_tx_exec/profile/flamegraph.svg
aws s3api put-object --bucket flamegraph.rooch.network --key "$PR_NUMBER"/"bench_tx_exec.svg" --body $ROOCH_DIR/target/criterion/bench_tx_exec/profile/profile.pb
Loading