Created
August 26, 2022 08:41
-
-
Save moukrea/94c972a41355099e488bbf03534d3e44 to your computer and use it in GitHub Desktop.
Bench duration of any command/script block using bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
COMMAND=${1} | |
if [[ ${COMMAND} == "" ]]; then | |
echo "[ERROR] No command to bench, terminating..." | |
exit 1 | |
fi | |
DATE_INIT=$(date +%s) ; \ | |
${COMMAND}; \ | |
echo "Command took $(($(date +%s)-DATE_INIT)) seconds" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment