现在的位置: 首页 > 综合 > 正文

real,user and sys 进程时间统计

2018年05月03日 ⁄ 综合 ⁄ 共 1405字 ⁄ 字号 评论关闭

在linux命令下,敲入time ls ,即可得到下面:

[root@mail ~]# time ls
2.doc                         bak                 mail       package
AdobePhotoshopCS4-11.0.1.rar index.html          Maildir
amavisd.conf                  install.log         main.cf
anaconda-ks.cfg               install.log.syslog master.cf

real    0m0.003s
user    0m0.000s
sys     0m0.002s

real,就是整个运行这个进程从一开始到结束的整个时间(时钟墙)

user,是指在运行这个进程中花在用户模式下的时间,即不包括内核的运行时间

sys,是指在运行这个进程,花在内核调用的时间,而不是代码库调用

user+sys=这个进程花的时间

下面是网上下的出处
Real, User and Sys process time statistics

One of these things is not like the other. Real refers to actual elapsed time; User and Sys refer to CPU time usedonly by the process.

  • Real is wall clock time - time from start to finish of the call. This is all elapsed time including time slices used by other processes and time the process spends blocked (for example if it is waiting for
    I/O to complete).
  • User is the amount of CPU time spent in user-mode code (outside the kernel) within the process. This is only actual CPU time used in executing the process. Other processes and time the process spends blocked
    do not count towards this figure.
  • Sys is the amount of CPU time spent in the kernel within the process. This means executing CPU time spent in system calls within the kernel, as opposed to library code, which is still running in user-space.
    Like ‘user’, this is only CPU time used by the process. See below for a brief description of kernel mode (also known as ’supervisor’ mode) and the system call mechanism.

User+Sys will tell you how much actual CPU time your process used.

from : http://blog.csdn.net/geekster/article/details/6640844

抱歉!评论已关闭.