Skip to content

Commit

Permalink
Simplify flamegraph script into a single one.
Browse files Browse the repository at this point in the history
  • Loading branch information
dsocolobsky committed Dec 6, 2024
1 parent 201ab7a commit 6b0c5e2
Show file tree
Hide file tree
Showing 4 changed files with 580 additions and 597 deletions.
25 changes: 0 additions & 25 deletions .github/scripts/flamegraph_reth.sh

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
#!/bin/bash

# This script sends 1000 transactions to a test account, per defined private key
# then polls the account balance until the expected balance has been reached
# and then kills the process. It also measures the elapsed time of the test and
# outputs it to Github Action's outputs.
SECONDS=0

iterations=1000
value=10000000
account=0x33c6b73432B3aeA0C1725E415CC40D04908B85fd
end_val=$((172 * $iterations * $value))

ethrex_l2 test load --path /home/runner/work/ethrex/ethrex/test_data/private_keys.txt -i $iterations -v --value $value --to $account

start_time=$(date +%s)
output=$(cast balance $account --rpc-url=http://localhost:1729 2>&1)
while [[ $output -le $end_val ]]; do
sleep 5
output=$(cast balance $account --rpc-url=http://localhost:1729 2>&1)
done
end_time=$(date +%s)
elapsed_time=$((end_time - start_time))
minutes=$((elapsed_time / 60))
seconds=$((elapsed_time % 60))
echo "Balance of $output reached in $minutes min $seconds s, killing process ethrex"
elapsed=$SECONDS
minutes=$((elapsed / 60))
seconds=$((elapsed % 60))
echo "Balance of $output reached in $minutes min $seconds s, killing process"

sudo pkill ethrex && while pgrep -l "cargo-flamegraph"; do echo "waiting for reth to exit... "; sleep 1;done;
sudo pkill "$PROGRAM" && while pgrep -l "cargo-flamegraph"; do echo "waiting for $PROGRAM to exit... "; sleep 1;done;

# We need this for the following job, to add to the static page
echo "time=$minutes minutes $seconds seconds" >> "$GITHUB_OUTPUT"
8 changes: 6 additions & 2 deletions .github/workflows/flamegraph_reporter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
flamegraph-ethrex:
name: Generate Flamegraph for Ethrex
runs-on: ubuntu-latest
env:
PROGRAM: ethrex
outputs:
time: ${{steps.generate-flamegraph-ethrex.outputs.time}}
steps:
Expand Down Expand Up @@ -65,7 +67,7 @@ jobs:
echo "waiting to execute load test..."
sleep 30 &&
echo "executing load test..."
bash .github/scripts/flamegraph.sh &&
bash /home/runner/work/ethrex/ethrex/.github/scripts/flamegraph_watcher.sh &&
echo "Load test finished"
- name: Generate SVG
Expand All @@ -84,6 +86,8 @@ jobs:
flamegraph-reth:
name: Generate Flamegraph for Reth
runs-on: ubuntu-latest
env:
PROGRAM: reth
outputs:
time: ${{steps.generate-flamegraph-reth.outputs.time}}
steps:
Expand Down Expand Up @@ -135,7 +139,7 @@ jobs:
--txpool.basefee-max-size 1000000000000 --txpool.queued-max-count 1000000000 &
echo "waiting to execute load test..."
sleep 180 &&
bash /home/runner/work/ethrex/ethrex/.github/scripts/flamegraph_reth.sh &&
bash /home/runner/work/ethrex/ethrex/.github/scripts/flamegraph_watcher.sh &&
echo "Load test finished"
- name: Generate SVG
Expand Down
Loading

0 comments on commit 6b0c5e2

Please sign in to comment.