function getTiming() { start=$1 end=$2 start_s=$(echo $start | cut -d '.' -f 1) start_ns=$(echo $start | cut -d '.' -f 2) end_s=$(echo $end | cut -d '.' -f 1) end_ns=$(echo $end | cut -d '.' -f 2) time=$(( ( 10#$end_s - 10#$start_s ) * 1000 + ( 10#$end_ns / 1000000 - 10#$start_ns / 1000000 ) )) echo "$time ms" } start=$(date +%s.%N) end=$(date +%s.%N) runtime=$(getTiming $start $end) echo "runtime: "$runtime
原创文章,作者:,如若转载,请注明出处:https://blog.ytso.com/275918.html