Skip to content

Y2023 ex13

Y2023 ex13 #255

Workflow file for this run

name: Flamegraph Benchmarks
# Controls when the workflow will run
on:
pull_request:
branches: [ main ]
paths-ignore:
- 'flamegraphs/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
benchName:
description: 'Banchmark name ex. bench_ex22'
required: true
default: 'all'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
flamegraph:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: install tools and libs
run: |
sudo apt install -y linux-tools-`uname -r`
- name: install flamegraph
run: |
cargo install flamegraph
sudo sysctl -w kernel.perf_event_paranoid=1
sudo sysctl -p
- name: flamegraph bench ALL
id: fgb
if: ${{ github.event.inputs.benchName == 'all' || github.event.inputs.benchName == '' }}
run: |
export CARGO_PROFILE_RELEASE_DEBUG=true
cargo bench --no-run
for f in `git diff --name-status -- main | grep -oP 'y\d+/ex\d+' | sort | uniq`; do
ex="${f##*/}"
year="${f%/*}"
name="bench_${year}${ex}"
cargo flamegraph --bench $name -- --bench > /dev/null || true
cp flamegraph.svg flamegraphs/${name}.svg
done
# for f in `find target/release/deps -executable -type f -name 'bench_*' | sort`; do
# file_name="${f##*/}"
# name="${file_name%-*}"
# cargo flamegraph --bench $name -- --bench > /dev/null || true
# cp flamegraph.svg flamegraphs/${name}.svg
# done
- name: flamegraph bench ONE
id: fgb_one
if: ${{ github.event.inputs.benchName != 'all' && github.event.inputs.benchName != '' }}
run: |
export CARGO_PROFILE_RELEASE_DEBUG=true
name="${{ github.event.inputs.benchName }}"
cargo flamegraph --bench $name -- --bench > /dev/null || true
cp flamegraph.svg flamegraphs/${name}.svg
- name: "Create the PR comment message"
id: pr_comment
run: |
echo ${{ github.event.number }} > pid.txt
python tools/flamegraph_comment_template.py ${{ github.repository }} $(git rev-parse HEAD) flamegraphs/* > message.txt
- name: Archive results
uses: actions/upload-artifact@v2
with:
# retention-days: 5
name: pr-comment
path: |
message.txt
pid.txt
flamegraphs/*