如下:
1 #./cf_workload_functions.sh 2 3 function timestamp(){ # get current timestamp 4 sec=`date +%s` 5 nanosec=`date +%N` 6 re=‘^[0-9]+$‘ 7 if ! [[ $nanosec =~ $re ]] ; then 8 $nanosec=0 9 fi 10 tmp=`expr $sec \* 1000 ` 11 msec=`expr $nanosec / 1000000 ` 12 echo `expr $tmp + $msec` 13 } 14 15 function start_monitor(){ 16 MONITOR_PID=`python monitor190620_1948.py` 17 echo ${MONITOR_PID} 18 } 19 20 START_TIME=`timestamp` 21 22 MONITOR_PID=`start_monitor` 23 echo ${MONITOR_PID} 24 25 END_TIME=`timestamp` 26 27 echo "scale=3;(${END_TIME}-${START_TIME})/1000" 28
原文地址:https://www.cnblogs.com/ratels/p/11074785.html
时间: 2024-11-06 09:40:59