LinuxSir.cn,穿越时空的Linuxsir!

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

什么是CPU时间

[复制链接]
发表于 2006-1-10 17:24:46 | 显示全部楼层 |阅读模式
cpu时间是user time+system time吗???
发表于 2006-1-10 17:46:03 | 显示全部楼层
好像不是,real time = sys + user + other
cpu时间好像不是这个意思!!
回复 支持 反对

使用道具 举报

发表于 2006-1-10 18:45:38 | 显示全部楼层
http://www.webopedia.com/TERM/C/CPU_time.html

CPU Time:
The amount of time the CPU is actually executing instructions. During the execution of most programs, the CPU sits idle much of the time while the computer fetches data from the keyboard or disk, or sends data to an output device. The CPU time of an executing program, therefore, is generally much less than the total execution time of the program. Multitasking operating systems take advantage of this by sharing the CPU among several programs.

CPU times are used for a variety of purposes: to compare the speed of two different processors, to gauge how CPU-intensive a program is, and to measure the amount of processing time being allocated to different programs in a multitasking environment.


不知道你所说的cpu时间指的是什么
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-1-10 18:50:21 | 显示全部楼层
那在LINUX怎么得到这个时间呢?????
回复 支持 反对

使用道具 举报

发表于 2006-1-10 19:23:24 | 显示全部楼层
用time命令可以获取一个应用程序所使用的real time(实时时间,进程所占用所有时间),user time(用户态时间,进程在用户态运行时的时间),system time(系统时间,进程在内核态运行时的时间)
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-1-11 05:38:25 | 显示全部楼层
我是说在我的程序中???
回复 支持 反对

使用道具 举报

发表于 2006-1-11 12:48:48 | 显示全部楼层
Post by ywchen2000
我是说在我的程序中???

man 2 times

另外,可参见apue的10.16节

btw:如果没有那本书,我可以发给你
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-1-12 05:36:27 | 显示全部楼层
呵呵,我要,ywchen2000@yahoo.com.cn
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-1-12 12:51:13 | 显示全部楼层
感谢rickxbx提供的帮助
回复 支持 反对

使用道具 举报

发表于 2006-1-12 13:12:41 | 显示全部楼层
Post by ywchen2000
感谢rickxbx提供的帮助

呵呵,不谢。
电子书收到了?
回复 支持 反对

使用道具 举报

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

本版积分规则

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