initial commit
This commit is contained in:
15
timing.sh
Executable file
15
timing.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
timing() {
|
||||
local start=$(($(date +%s%N)/1000000))
|
||||
result=$($@)
|
||||
local exit_code=$?
|
||||
local end=$(($(date +%s%N)/1000000))
|
||||
tookms=$((${end}-${start}))
|
||||
# tooks=$(bc <<< "scale=3; $tookms/1000")
|
||||
tooks=$(echo "scale=3; $tookms/1000" | bc | sed 's/^\./0./')
|
||||
# echo >&2 "took ~${tookms}ms. exited with ${exit_code}"
|
||||
echo $tooks $result
|
||||
return $exit_code
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user