#!/bin/bash ROOT=$(dirname $0)/.. USER=$(whoami) . "${ROOT}/scripts/setup_bls_build_flags.sh" set -x set -eo pipefail function check_result() { find $log_folder -name leader-*.log > $log_folder/all-leaders.txt find $log_folder -name validator-*.log > $log_folder/all-validators.txt echo ====== RESULTS ====== results=$($ROOT/test/cal_tps.sh $log_folder/all-leaders.txt $log_folder/all-validators.txt) echo $results | tee -a $LOG_FILE echo $results > $log_folder/tps.log } function cleanup() { for pid in `/bin/ps -fu $USER| grep "harmony\|txgen\|soldier\|commander\|profiler\|beacon\|bootnode" | grep -v "grep" | grep -v "vi" | awk '{print $2}'`; do echo 'Killed process: '$pid $DRYRUN kill -9 $pid 2> /dev/null done # Remove bc_config.json before starting experiment. rm -f bc_config.json rm -rf ./db/harmony_* } function killnode() { local port=$1 if [ -n "port" ]; then pid=$(/bin/ps -fu $USER | grep "harmony" | grep "$port" | awk '{print $2}') echo "killing node with port: $port" $DRYRUN kill -9 $pid 2> /dev/null echo "node with port: $port is killed" fi } trap cleanup SIGINT SIGTERM function usage { local ME=$(basename $0) cat<&1 | tee -a $LOG_FILE ) & sleep 5 done