real,user and sys 进程时间统计

本文详细介绍了在Linux环境下使用timels命令的功能与输出,包括文件夹与文件的备份状态、邮件信息、软件包、索引文件等,并解释了运行时间的三个组成部分:实际运行时间、用户模式时间和内核模式时间。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值