From 31098e03c7502c5011529726426d3d7d413ef407 Mon Sep 17 00:00:00 2001 From: pvincent Date: Fri, 12 Aug 2022 17:08:26 +0400 Subject: [PATCH] timing script --- install.sh | 2 +- tools/timing | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100755 tools/timing diff --git a/install.sh b/install.sh index 51a51ff..352bdac 100755 --- a/install.sh +++ b/install.sh @@ -1,7 +1,7 @@ #!/bin/bash CURDIR=$PWD -REQUIRED_PKGS=(file git) +REQUIRED_PKGS=(file git bc) function usage() { echo 'usage: --host | --containers | --full | --one-container ' diff --git a/tools/timing b/tools/timing new file mode 100755 index 0000000..32ba5ac --- /dev/null +++ b/tools/timing @@ -0,0 +1,13 @@ +#!/bin/bash + +echo >&2 "time elapsed in seconds..." +START=$(date +%s.%N) +# do something ####################### + +$@ + +####################################### +END=$(date +%s.%N) + +DIFF=$(echo "scale=2; (${END} - ${START}) / 1" | bc) +echo "${DIFF}"