Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 4 additions & 0 deletions tooling/import_benchmark/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
BENCH_ID ?= 1
NETWORK ?= hoodi
NUM_REPETITIONS ?= 3

help:
@printf "run-bench: ## Runs a bench for the current pr. \nParameters:\n -BENCH_ID: number for the log file where it will\
Expand All @@ -13,3 +14,6 @@ run-bench: ## Runs a bench for the current pr. parameters -BENCH_ID: number for
rm -rf ~/.local/share/temp
cp -r ~/.local/share/ethrex_$(NETWORK)_bench/ethrex ~/.local/share/temp
cd ../.. && cargo r --release -- --network $(NETWORK) --datadir ~/.local/share/temp import-bench ~/.local/share/ethrex_$(NETWORK)_bench/chain.rlp | tee bench-$(BENCH_ID).log

run-benches:
./benchmark.sh $(NETWORK) $(NUM_REPETITIONS)
18 changes: 18 additions & 0 deletions tooling/import_benchmark/benchmark.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

set -euo pipefail

NETWORK=$1
NUM_REPETITIONS=$2

touch bench-0.log
bench_id=$(ls bench-*.log | cut -d '-' -f 2 | cut -d '.' -f 1 | sort -n | tail -1)

cd ../..

for i in $(seq 1 $NUM_REPETITIONS); do
bench_id=$((bench_id + 1))
rm -rf ~/.local/share/temp
cp -r ~/.local/share/ethrex_${NETWORK}_bench/ethrex ~/.local/share/temp
cargo r --release -- --network $NETWORK --datadir ~/.local/share/temp import-bench ~/.local/share/ethrex_${NETWORK}_bench/chain.rlp | tee bench-${bench_id}.log
done
Loading