Chinaunix首页 | 论坛 | 博客
  • 博客访问: 311581
  • 博文数量: 53
  • 博客积分: 2510
  • 博客等级: 少校
  • 技术积分: 598
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-09 13:20
文章分类

全部博文(53)

文章存档

2011年(2)

2010年(22)

2009年(29)

我的朋友

分类: LINUX

2010-04-08 14:02:46

在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 used only 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.

阅读(1552) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~