new: timer

This commit is contained in:
Raneet Debnath 2022-11-18 16:18:34 +05:30
parent 87c54fa7be
commit 1da5b36da9

View file

@ -5,6 +5,8 @@ balanceInit=$(docker exec bor0 bash -c "bor attach /root/.bor/data/bor.ipc -exec
stateSyncFound="false" stateSyncFound="false"
checkpointFound="false" checkpointFound="false"
SECONDS=0
start_time=$SECONDS
while true while true
do do
@ -17,12 +19,14 @@ do
fi fi
if (( $balance > $balanceInit )); then if (( $balance > $balanceInit )); then
stateSyncTime=$(( SECONDS - start_time ))
stateSyncFound="true" stateSyncFound="true"
fi fi
checkpointID=$(curl -sL http://localhost:1317/checkpoints/latest | jq .result.id) checkpointID=$(curl -sL http://localhost:1317/checkpoints/latest | jq .result.id)
if [ $checkpointID != "null" ]; then if [ $checkpointID != "null" ]; then
checkpointTime=$(( SECONDS - start_time ))
checkpointFound="true" checkpointFound="true"
fi fi
@ -32,3 +36,5 @@ do
done done
echo "Both state sync and checkpoint went through. All tests have passed!" echo "Both state sync and checkpoint went through. All tests have passed!"
echo "Time taken for state sync: $(printf '%02dm:%02ds\n' $(($stateSyncTime%3600/60)) $(($stateSyncTime%60)))"
echo "Time taken for checkpoint: $(printf '%02dm:%02ds\n' $(($checkpointTime%3600/60)) $(($checkpointTime%60)))"