Chinaunix

标题: 怎么看脚本执行的时间呢 [打印本页]

作者: prcardin    时间: 2013-10-08 11:46
标题: 怎么看脚本执行的时间呢
怎么看脚本执行的时间呢
脚本运行了。怎么看脚本运行用去的时间呢,看脚本执行过程花费了多少时间
作者: reyleon    时间: 2013-10-08 11:49
time bash script.sh

在运行你的脚本的前面加上time命令
作者: prcardin    时间: 2013-10-08 12:05
谢谢哈。  

real    0m17.862s
user    0m9.205s
sys     0m2.260s

这个各是什么含义呢

回复 2# reyleon


   
作者: hanfeng122525    时间: 2013-10-09 14:31
本帖最后由 hanfeng122525 于 2013-10-09 14:35 编辑


while true
do
sleep 1
echo "1++"
done &

BID=$!
./jiaoben

kill $BID



脚本运行时在后台运行一个计时脚本
作者: Shell_HAT    时间: 2013-10-09 14:54
回复 3# prcardin


http://linux.die.net/man/1/time
(i) the elapsed real time between invocation and termination

(ii) the user CPU time (the sum of the tms_utime and tms_cutime values in a struct tms as returned by times(2))

(iii) the system CPU time (the sum of the tms_stime and tms_cstime values in a struct tms as returned by times(2))




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2