LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1198|回复: 4

times命令列出的四个时间值到底有什么区别阿?哪个是指令执行时间呢?谢谢~

[复制链接]
发表于 2005-10-2 18:53:50 | 显示全部楼层 |阅读模式
[root@GridServer zqx]# times rm -f test1001
0m0.016s 0m0.006s
0m0.010s 0m0.023s
man times了一下,还是不太了解,哪一个是指令真正执行时间啊?

struct tms {
              clock_t tms_utime;  /* user time */
              clock_t tms_stime;  /* system time */
              clock_t tms_cutime; /* user time of children */
              clock_t tms_cstime; /* system time of children */
       };

The tms_utime field contains the CPU time spent executing  instructions of  the calling process.  那tms_utime是不是就是指令执行实际需要的时间?

请教各位了,谢谢~
发表于 2005-10-3 19:24:50 | 显示全部楼层
我想你需要的恐怕是time
而不是times
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-10-3 21:13:27 | 显示全部楼层
那请问是不是显示
real
user
sys
其中real就是指令执行时间,包括了用户态和核心态用时总和?

谢谢~~
回复 支持 反对

使用道具 举报

发表于 2005-10-4 23:34:45 | 显示全部楼层
不,那个应该是从开始exec到wait结束的时间
中间会有和其他进程的上下文切换
回复 支持 反对

使用道具 举报

发表于 2005-10-7 18:54:48 | 显示全部楼层
real <> user+sys
CPU在多个线程间切换
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表