diff --git a/.github/scripts/flamegraph_reth.sh b/.github/scripts/flamegraph_reth.sh deleted file mode 100644 index 3bd6bd7d3c..0000000000 --- a/.github/scripts/flamegraph_reth.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -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 reth" - -sudo pkill reth && while pgrep -l "cargo-flamegraph"; do echo "waiting for reth 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" diff --git a/.github/scripts/flamegraph.sh b/.github/scripts/flamegraph_watcher.sh similarity index 66% rename from .github/scripts/flamegraph.sh rename to .github/scripts/flamegraph_watcher.sh index 18f1a0641b..c47c264124 100644 --- a/.github/scripts/flamegraph.sh +++ b/.github/scripts/flamegraph_watcher.sh @@ -1,5 +1,10 @@ #!/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. + iterations=1000 value=10000000 account=0x33c6b73432B3aeA0C1725E415CC40D04908B85fd @@ -17,9 +22,9 @@ 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" +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" diff --git a/.github/workflows/flamegraph_reporter.yaml b/.github/workflows/flamegraph_reporter.yaml index 50e521e227..59221fe902 100644 --- a/.github/workflows/flamegraph_reporter.yaml +++ b/.github/workflows/flamegraph_reporter.yaml @@ -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: @@ -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 @@ -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: @@ -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