From 23e3b492dbb27ca01790b5679b6a92a8da2e2629 Mon Sep 17 00:00:00 2001 From: fborello-lambda Date: Thu, 9 Jan 2025 09:53:38 -0300 Subject: [PATCH] fix: calculate time to process the balance --- .github/scripts/flamegraph_watcher.sh | 11 ++++++++++- scripts/flamegraph.sh | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/scripts/flamegraph_watcher.sh b/.github/scripts/flamegraph_watcher.sh index d1b9f154b..82956ef52 100644 --- a/.github/scripts/flamegraph_watcher.sh +++ b/.github/scripts/flamegraph_watcher.sh @@ -1,16 +1,25 @@ #!/bin/bash -# This script sends 171 * 500 transactions to a test account, per defined private key +# This script sends 171 * 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=50 value=1 account=0x33c6b73432B3aeA0C1725E415CC40D04908B85fd +end_val=$((171 * $iterations * $value)) start_time=$(date +%s) ethrex_l2 test load --path /home/runner/work/ethrex/ethrex/test_data/private_keys.txt -i $iterations -v --value $value --to $account >/dev/null + +output=$(ethrex_l2 info -b -a $account 2>&1) + +while [[ $output -lt $end_val ]]; do + sleep 5 + output=$(ethrex_l2 info -b -a $account 2>&1) +done end_time=$(date +%s) + elapsed=$((end_time - start_time)) minutes=$((elapsed / 60)) diff --git a/scripts/flamegraph.sh b/scripts/flamegraph.sh index d268c94da..e4a7acade 100644 --- a/scripts/flamegraph.sh +++ b/scripts/flamegraph.sh @@ -1,16 +1,25 @@ #!/bin/bash -# This script sends 171 * 500 transactions to a test account, per defined private key +# This script sends 171 * 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=500 value=1 account=0x33c6b73432B3aeA0C1725E415CC40D04908B85fd +end_val=$((171 * $iterations * $value)) start_time=$(date +%s) ethrex_l2 test load --path ./test_data/private_keys.txt -i $iterations -v --value $value --to $account >/dev/null + +output=$(ethrex_l2 info -b -a $account 2>&1) + +while [[ $output -lt $end_val ]]; do + sleep 5 + output=$(ethrex_l2 info -b -a $account 2>&1) +done end_time=$(date +%s) + elapsed=$((end_time - start_time)) minutes=$((elapsed / 60))