Skip to content

Instantly share code, notes, and snippets.

@TrevorBenson
Created August 28, 2022 17:05
Show Gist options
  • Save TrevorBenson/5c2cf9d22167ac08ac3736443998322e to your computer and use it in GitHub Desktop.
Save TrevorBenson/5c2cf9d22167ac08ac3736443998322e to your computer and use it in GitHub Desktop.
Check total time spent validating chain after node restart
timestamp() { date '+%s' --date="$1"; }
check_validation_time() {
file=$1
finalChunk=$(jq -r '. | select(.data.initialChunk == "0") | .data.finalChunk' ${file})
startTime=$(jq -r '. | select(.data.initialChunk == "0") | .at' ${file})
endTime=$(jq -r --arg myfc ${finalChunk} '. | select(.data.initialChunk == $myfc) | .at' ${file})
totalTime=$( echo $(( $(timestamp ${endTime}) - $(timestamp ${startTime}) )) )
HMS=$(date -d@${totalTime} -u +%H:%M:%S)
echo "The total time spent on chain validation was: ${HMS}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment